float toolbar!

This is a discussion on float toolbar! within the Windows Programming forums, part of the Platform Specific Boards category; I use MFC, and make my programs by AppWizard. How can I make the toolbar to be float, like the ...

  1. #1
    c--
    c-- is offline
    Registered User
    Join Date
    Dec 2001
    Posts
    43

    Question float toolbar!

    I use MFC, and make my programs by AppWizard.

    How can I make the toolbar to be float, like the Tools Toolbar In PhotoShop.

    I don't know if the question is clear, I mean that I dont want the toolbar do be ducked like the word tool bars...

  2. #2
    'AlHamdulillah
    Join Date
    Feb 2003
    Posts
    790
    what you are seeing are actually child windows off of the main window. I am rather new to windows programming, so I will let someone explain more.

  3. #3
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    I've never used MFC, so I'm not familiar with how you create stuff. But to make a "floating window" you have to specify the main window as the "Owner window" when you create the toolbar window (lots of windows... ).
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  4. #4
    c--
    c-- is offline
    Registered User
    Join Date
    Dec 2001
    Posts
    43
    thank you...
    but can any MFC user answer my question.

  5. #5
    Registered User SAMSAM's Avatar
    Join Date
    Nov 2001
    Posts
    218
    may be this helps
    CFrameWnd::FloatControlBar
    CFrameWnd* FloatControlBar( CControlBar * pBar, CPoint point, DWORD dwStyle = CBRS_ALIGN_TOP );

    Return Value

    Pointer to the current frame window.

    Parameters

    pBar

    Points to the control bar to be floated.

    point

    The location, in screen coordinates, where the top left corner of the control bar will be placed.

    dwStyle

    Specifies whether to align the control bar horizontally or vertically within its new frame window. It can be any one of the following:

    CBRS_ALIGN_TOP Orients the control bar vertically.


    CBRS_ALIGN_BOTTOM Orients the control bar vertically.


    CBRS_ALIGN_LEFT Orients the control bar horizontally.


    CBRS_ALIGN_RIGHT Orients the control bar horizontally.
    If styles are passed specifying both horizontal and vertical orientation, the toolbar will be oriented horizontally.

    Remarks

    Call this function to cause a control bar to not be docked to the frame window. Typically, this is done at application startup when the program is restoring settings from the previous execution.

    This function is called by the framework when the user causes a drop operation by releasing the left mouse button while dragging the control bar over a location that is not available for docking.

    CFrameWnd Overview | Class Members | Hierarchy Chart

    See Also CFrameWnd:ockControlBar

    Contact Us | E-Mail this Page | MSDN Flash Newsletter | Legal
    2003 Microsoft Corporation. All rights reserved. Terms of Use Privacy Statement


    or;

    DockWindow.h
    //
    // A floating tool-window library
    //
    // Copyright J Brown 2001
    // Freeware
    //
    #ifndef DOCKWINDOW_INCLUDED
    #define DOCKWINDOW_INCLUDED

    #ifdef __cplusplus
    extern "C" {
    #endif

    #pragma pack(push, 1)

    typedef struct
    {
    DWORD dwStyle; //styles..

    int xpos; //coordinates of FRAME when floating
    int ypos;

    int cxFloating; //size of CONTENTS when floating
    int cyFloating;

    int nDockedSize; //width/height of window when docked..
    BOOL fDocked; //docked/floating?
    UINT uDockedState; //left/right/top/bottom when docked?

    RECT rcBorderDock; //border to place around each side of contents
    RECT rcBorderFloat; //border to place around each side of contents

    DWORD dwUser; //whatever..

    //
    // Internal to DockWindow library, do not modify
    //
    int nFrameWidth; //window frame width when floating
    int nFrameHeight; //(Private)

    HWND hwndContents; //handle to the window to host
    HWND hwnd; //handle to container (THIS!!!)

    BOOL fDragging; //Are we dragging?
    RECT oldrect; //


    } DockWnd;

    // Use in DWN_ISDOCKABLE

    typedef struct
    {
    NMHDR hdr;
    HWND hwndDock; /* Handle to dock-window */
    DockWnd *pDockWnd; /* Pointer to the DockWnd structure for that window */
    RECT *dragrect; /* Current drag-rectangle */

    } NMDOCKWNDQUERY;

    #pragma pack(pop)

    //
    // Function declarations
    //
    HWND CreateDockWnd(DockWnd *dwp, HWND hwndParent, TCHAR szCaption[]);
    void DockWnd_ToggleDockingMode(HWND hwnd);

    BOOL DockWnd_Position (HWND hwndMain, HDWP hdwp, DockWnd dwnd[], int nNumDockWnds, RECT *rect);
    UINT DockWnd_GetDockSide (HWND hwnd, NMDOCKWNDQUERY *nmdwq, RECT *prc1, RECT *prc2);


    LRESULT HANDLE_NCACTIVATE (HWND hwndMain, HWND hwndMsg, WPARAM wParam, LPARAM lParam);
    LRESULT HANDLE_ENABLE (HWND hwndMain, HWND hwndMsg, WPARAM wParam, LPARAM lParam);

    //
    // DockWnd styles
    //
    #define DWS_BORDERTOP 0x0001 //draw a top etched border WHEN DOCKED
    #define DWS_BORDERBOTTOM 0x0002 //draw a bottom etched border WHEN DOCKED
    #define DWS_BORDERLEFT 0x0004 //draw a top etched border WHEN DOCKED
    #define DWS_BORDERRIGHT 0x0008 //draw a bottom etched border WHEN DOCKED
    #define DWS_DRAWGRIPPERDOCKED 0x0010 //draw a gripper when docked
    #define DWS_DRAWGRIPPERFLOATING 0x0020 //draw a gripper when floating
    #define DWS_FORCEDOCK 0x0040
    #define DWS_FORCEFLOAT 0x0080
    #define DWS_RESIZABLE 0x0100 //is resizable when docked?
    #define DWS_NORESIZE 0x0200 //prevent resize when floating

    #define DWS_USEBORDERS 0x1000 //use the rcBorders member to define additional border space
    #define DWS_NOSETFOCUS 0x2000
    #define DWS_NODESTROY 0x4000 //hides the dock-window instead of destroying it

    #define DWS_ALLOW_DOCKLEFT 0x10000
    #define DWS_ALLOW_DOCKRIGHT 0x20000
    #define DWS_ALLOW_DOCKTOP 0x40000
    #define DWS_ALLOW_DOCKBOTTOM 0x80000

    #define DWS_ALLOW_DOCKALL (DWS_ALLOW_DOCKLEFT | \
    DWS_ALLOW_DOCKBOTTOM | \
    DWS_ALLOW_DOCKRIGHT | \
    DWS_ALLOW_DOCKTOP)

    #define DWS_DOCKED_NOTDOCKED 0
    #define DWS_DOCKED_FLOATING 0
    #define DWS_DOCKED_LEFT 0x10000
    #define DWS_DOCKED_RIGHT 0x20000
    #define DWS_DOCKED_TOP 0x40000
    #define DWS_DOCKED_BOTTOM 0x80000

    //
    // DockWnd message notifications...
    //
    #define DWN_BASE (0U - 2048U)
    #define DWN_HIDDEN (DWN_BASE - 0)
    #define DWN_DOCKED (DWN_BASE - 1)
    #define DWN_UNDOCKED (DWN_BASE - 2)
    #define DWN_CLOSED (DWN_BASE - 3)
    #define DWN_ISDOCKABLE (DWN_BASE - 4)


    #ifdef __cplusplus
    }
    #endif

    #endif

  6. #6
    c--
    c-- is offline
    Registered User
    Join Date
    Dec 2001
    Posts
    43
    than you very much.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 05-13-2009, 03:25 PM
  2. Replies: 14
    Last Post: 06-28-2006, 01:58 AM
  3. Could somebody please help me with this C program
    By brett73 in forum C Programming
    Replies: 6
    Last Post: 11-25-2004, 01:19 AM
  4. Half-life SDK, where are the constants?
    By bennyandthejets in forum Game Programming
    Replies: 29
    Last Post: 08-25-2003, 11:58 AM
  5. How do you search & sort an array?
    By sketchit in forum C Programming
    Replies: 30
    Last Post: 11-03-2001, 04:26 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21