Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Serializing new control bars Collapse All
Subject Author Date
Robert Webb Aug 25, 2009 - 1:32 AM

Hi,


I call CExtControlBar::ProfileBarStateSerialize to serialize the state of control bars.  The first time a user runs the program, this function returns false and I know to set my control bars up in the default way instead.  However, if I add a new control bar to the program, then the function returns true for previous users because they still have old serialization data, but the new control bar neither gets serialized (because it wasn’t in the old version of the data) nor does it get initialised to a default layout.  How should I handle this?  How do I reckonise after calling CExtControlBar::ProfileBarStateSerialize that a particular control bar failed to load any data?


Thanks,


Rob.

Technical Support Aug 26, 2009 - 5:10 AM

The control bar state serialization code requires exact matching between the state data and bars created in the main frame window. There are two additional subsystems which support dynamic count of bars:

- The CExtCustomizeSite class supports dynamic count of toolbars because the user can create new toolbars in the customize dialog.

- The CExtDynamicBarSite class manages dynamically allocated resizable control bars (CExtDynamicControlBar).

The states of these subsystems should be loaded before loading bar states. These subsystems should create dynamic bars first. Both subsystems can really make your application using version dependent counts of control bars and provide support for version independent bar states.

Robert Webb Aug 25, 2009 - 2:30 AM

Also, even though I call SetInitDesiredSizeFloating(CSize(144, 219)) for my new control bar, it’s floating size after the first serialization (using old data that doesn’t include the new bar) is set back to (16,16), which gives me a tiny and useless control bar. Does this happen to everyone using ProfUIS?  Surely I must be doing something wrong, but what?


Finally, an assertion is hit during startup:



>    ProfUIS285nd.dll!CExtCustomizeSite::CustomizeStateSerialize(CArchive & ar={...}, bool bEnableThrowExceptions=false)  Line 10758 + 0x22 bytes    C++



But there’s no error.  A new control bar has been added since the user last ran the program, so the control bar can’t be found in the last serialisation data.  I don’t think there should be an assertion unless something has gone wrong.


Thanks,


Rob.


 

Robert Webb Aug 25, 2009 - 2:46 AM

Seems a lot of the default data in a control bar is overridden with rubbish when no serialisation data is found, including the initial floating size, horizontal docking size, vertical docking size, and the bar becomes hidden.

Robert Webb Aug 25, 2009 - 2:18 AM

I just tried to solve this by overriding CExtControlBar::OnExtBarStateSerializationComplete() to set a flag when the control bar has been serialised.  Unfortunately it seems this gets called even when the control bar did not find any serialisation data.  Maybe there should be an extra arg to say whether the bar really was initialised from setup data.


Rob.