docking dialogbars
-
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 )
-
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 )
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.
-
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.
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 )
-
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 )
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 :)
-
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 :)
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.
-
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.
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.
-
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.
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 )
-
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 )
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.
-
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.
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?
-
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?
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.
-
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.
-
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 )