Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. docking dialogbars

docking dialogbars

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
12 Posts 2 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Peter Marino
    wrote on last edited by
    #1

    I have a class that docks resizable dialogbars,.. but I have a problem saving the state and loading it. The states are actually save/load correctly but because my dialogbars are dynamic, by this I mean that if I start the application then there might only be 3 dialogbars and next time prehaps only 10 or 1 or whatever... The LoadBarState crashes when I do this,.. does anybody know that MFC internal code does to save the dialogbar states,.. prehaps saving and loading it myself might work better... but I can't see what the internal values are? anybody. Peter Marino ( IO Interactive )

    D 1 Reply Last reply
    0
    • P Peter Marino

      I have a class that docks resizable dialogbars,.. but I have a problem saving the state and loading it. The states are actually save/load correctly but because my dialogbars are dynamic, by this I mean that if I start the application then there might only be 3 dialogbars and next time prehaps only 10 or 1 or whatever... The LoadBarState crashes when I do this,.. does anybody know that MFC internal code does to save the dialogbar states,.. prehaps saving and loading it myself might work better... but I can't see what the internal values are? anybody. Peter Marino ( IO Interactive )

      D Offline
      D Offline
      Diarrhio
      wrote on last edited by
      #2

      The way I got around this was to create the dialogbars myself (using new) BEFORE calling LoadBarState. That way, you don't rely on the framework to create them for you. This assumes, though, that the dialogbars you want to open on launch of your app are the ones that were open when you last shut it down. Let me know if you need any more help.

      P 1 Reply Last reply
      0
      • D Diarrhio

        The way I got around this was to create the dialogbars myself (using new) BEFORE calling LoadBarState. That way, you don't rely on the framework to create them for you. This assumes, though, that the dialogbars you want to open on launch of your app are the ones that were open when you last shut it down. Let me know if you need any more help.

        P Offline
        P Offline
        Peter Marino
        wrote on last edited by
        #3

        That's my main problem,.. all my dialogbars are created via plugins,.. and I can't assume that all users will have the same number or even the same plugins when they start the application. So I need a general way of positioning the dialogbars on startup. For example if a user has dialog A,B,C. And next time he starts he has dialogbar A and D. Then dialogbar A should have the same position as last time, and because dialog D is new it should be set to floating. The main problem is that LoadBarState is expecting the same number of dialogs and that the dialogbars have the same ID. Because the plugins are dynamic then all dialogbars are given different ID numbers at startup. I hope this makes it clearer., Peter Marino ( IO Interactive )

        D 1 Reply Last reply
        0
        • P Peter Marino

          That's my main problem,.. all my dialogbars are created via plugins,.. and I can't assume that all users will have the same number or even the same plugins when they start the application. So I need a general way of positioning the dialogbars on startup. For example if a user has dialog A,B,C. And next time he starts he has dialogbar A and D. Then dialogbar A should have the same position as last time, and because dialog D is new it should be set to floating. The main problem is that LoadBarState is expecting the same number of dialogs and that the dialogbars have the same ID. Because the plugins are dynamic then all dialogbars are given different ID numbers at startup. I hope this makes it clearer., Peter Marino ( IO Interactive )

          D Offline
          D Offline
          Diarrhio
          wrote on last edited by
          #4

          Damnit! I just typed out this whole response to you, and Explorer ate it. Frigging microsoft... Anyways, here's the gist of what i typed: I can tell that my app will be heading down this exact same path, so I hope we find an answer to this question together. I think that Load/SaveBarState info is all contextual info, meaning, the info is based on the dialogbars docked position/size relative to (in the context of) all the other docked dialogbars and toolbars, so I don't think LoadBarState will ever be able to work for you under these circumstances. Even if you get around that, you'll still have to figure out a way to get LoadBarState to ignore (i.e. not create) dialog bars for which the user doesn't have a dll for. There is a method on CFrameWnd called GetDockState which fills a CDockState object. You might try calling that to see what you can find. But, I think your best bet is to do the loading/saving of docking info yourself, and use a couple of undocumented public methods on CControlBar: void GetBarInfo(CControlBarInfo* pInfo); void SetBarInfo(CControlBarInfo* pInfo, CFrameWnd* pFrameWnd); browse the MFC source code to see how these work. They are declared in the header AFXEXT.H, and CControlBarInfo is defined in AFXPRIV.H, as are a couple of other useful classes. Let me know what you find! D :)

          D 1 Reply Last reply
          0
          • D Diarrhio

            Damnit! I just typed out this whole response to you, and Explorer ate it. Frigging microsoft... Anyways, here's the gist of what i typed: I can tell that my app will be heading down this exact same path, so I hope we find an answer to this question together. I think that Load/SaveBarState info is all contextual info, meaning, the info is based on the dialogbars docked position/size relative to (in the context of) all the other docked dialogbars and toolbars, so I don't think LoadBarState will ever be able to work for you under these circumstances. Even if you get around that, you'll still have to figure out a way to get LoadBarState to ignore (i.e. not create) dialog bars for which the user doesn't have a dll for. There is a method on CFrameWnd called GetDockState which fills a CDockState object. You might try calling that to see what you can find. But, I think your best bet is to do the loading/saving of docking info yourself, and use a couple of undocumented public methods on CControlBar: void GetBarInfo(CControlBarInfo* pInfo); void SetBarInfo(CControlBarInfo* pInfo, CFrameWnd* pFrameWnd); browse the MFC source code to see how these work. They are declared in the header AFXEXT.H, and CControlBarInfo is defined in AFXPRIV.H, as are a couple of other useful classes. Let me know what you find! D :)

            D Offline
            D Offline
            Diarrhio
            wrote on last edited by
            #5

            p.s. This comment is at the top of those header files. So, use at your own discretion/caution: // This source code is only intended as a supplement to the // Microsoft Foundation Classes Reference and related // electronic documentation provided with the library. // See these sources for detailed information regarding the // Microsoft Foundation Classes product.

            D 1 Reply Last reply
            0
            • D Diarrhio

              p.s. This comment is at the top of those header files. So, use at your own discretion/caution: // This source code is only intended as a supplement to the // Microsoft Foundation Classes Reference and related // electronic documentation provided with the library. // See these sources for detailed information regarding the // Microsoft Foundation Classes product.

              D Offline
              D Offline
              Diarrhio
              wrote on last edited by
              #6

              oops. meant to copy this in: // Note: This header file contains useful classes that are documented only // in the MFC Technical Notes. These classes may change from version to // version, so be prepared to change your code accordingly if you utilize // this header. In the future, commonly used portions of this header // may be moved and officially documented.

              P 1 Reply Last reply
              0
              • D Diarrhio

                oops. meant to copy this in: // Note: This header file contains useful classes that are documented only // in the MFC Technical Notes. These classes may change from version to // version, so be prepared to change your code accordingly if you utilize // this header. In the future, commonly used portions of this header // may be moved and officially documented.

                P Offline
                P Offline
                Peter Marino
                wrote on last edited by
                #7

                ok,.. I've worked a couple hours on this,.. and I have a version now that can save some of the dialogbar states and reload them dynamically. This works also if the ID has changed and if the dialogbar is new or delete... so far so good.... now I have problem with that if two dialogbars share the same row,.. they do not get put into the same row,.. do you know what information that tells CControlBar what row/column a dialogbar is in? Peter Marino ( IO Interactive www.marino.dk )

                D 1 Reply Last reply
                0
                • P Peter Marino

                  ok,.. I've worked a couple hours on this,.. and I have a version now that can save some of the dialogbar states and reload them dynamically. This works also if the ID has changed and if the dialogbar is new or delete... so far so good.... now I have problem with that if two dialogbars share the same row,.. they do not get put into the same row,.. do you know what information that tells CControlBar what row/column a dialogbar is in? Peter Marino ( IO Interactive www.marino.dk )

                  D Offline
                  D Offline
                  Diarrhio
                  wrote on last edited by
                  #8

                  I'm not exactly sure. There is a class derived from CControlBar called CDockBar, which is does the docking for controlbars. You might look at CFrameWnd::DockControlBar source, and CDockBar::DockControlBar source, and the MSDN docs on them, and see what you can do. I think all you need to do is supply a rectangle in screen coordinates to CDockBar::DockControlBar, but I haven't looked into it enough... Lemme know, and good luck.

                  P 1 Reply Last reply
                  0
                  • D Diarrhio

                    I'm not exactly sure. There is a class derived from CControlBar called CDockBar, which is does the docking for controlbars. You might look at CFrameWnd::DockControlBar source, and CDockBar::DockControlBar source, and the MSDN docs on them, and see what you can do. I think all you need to do is supply a rectangle in screen coordinates to CDockBar::DockControlBar, but I haven't looked into it enough... Lemme know, and good luck.

                    P Offline
                    P Offline
                    Peter Marino
                    wrote on last edited by
                    #9

                    The CDockBar is not documented,.. and I only have the header source,... do you know where I could get some information on it? and where I could get the .cpp source for it?

                    D 1 Reply Last reply
                    0
                    • P Peter Marino

                      The CDockBar is not documented,.. and I only have the header source,... do you know where I could get some information on it? and where I could get the .cpp source for it?

                      D Offline
                      D Offline
                      Diarrhio
                      wrote on last edited by
                      #10

                      It's not documented because it's likely that the methods and variables of the class will change in future releases. If you go to your VC installation Directory: ...\Microsoft Visual Studio\VC98\MFC\SRC and do a search for files below that directory with the text "CDockBar::" in them. You should get BarDock.cpp and DockStat.cpp. CDockBar implementation is in BarDock.cpp, but look in both for useful info.

                      D 1 Reply Last reply
                      0
                      • D Diarrhio

                        It's not documented because it's likely that the methods and variables of the class will change in future releases. If you go to your VC installation Directory: ...\Microsoft Visual Studio\VC98\MFC\SRC and do a search for files below that directory with the text "CDockBar::" in them. You should get BarDock.cpp and DockStat.cpp. CDockBar implementation is in BarDock.cpp, but look in both for useful info.

                        D Offline
                        D Offline
                        Diarrhio
                        wrote on last edited by
                        #11

                        Any luck, peter?

                        P 1 Reply Last reply
                        0
                        • D Diarrhio

                          Any luck, peter?

                          P Offline
                          P Offline
                          Peter Marino
                          wrote on last edited by
                          #12

                          I've done some debugging,.. checking to see how the CControlBar is intergrated with MFC... I would really like to say thanks for pointing out that the source code for MFC was on my harddisk :-) I didn't even know that. I haven't any solution right now,.. and I have just started my vacation and will be leaving tommorow to see the WM for Tumbling/Trampolin the next 1½ weeks,... so there will be a pause before I can continue,... but as soon as I get back,.. I'll continue where I left off and notify you of my status. thanx again Peter Marino ( IO Interactive )

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups