Saving CommandBar Position

Add-in Express™ Support Service
That's what is more important than anything else

Saving CommandBar Position
Its loading it again that causes a problem 
Nicholas Glasier


Guest


Hi,
Ive been saving the Commandbars Top, Left and Row values and reloading them again without any problem, except that the bar is always floating even though its over the place it was docked at.

I can save the Property CommandBar.Position with no problem by casting it as an integer. Loading it again is causing an exception. I tried reading into an integer and then casting it as type TadxMsoBarPosition, and I tried this in both the AddinInitialize and StartupComplete events with no luck. Any ideas?

TIA Nick
Posted 01 Nov, 2005 04:59:46 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Nicholas,

In what order do you set the CommandBarLeft, CommandBarTop, RowIndex and Position properties? In our case the Position property is set first.

Posted 02 Nov, 2005 07:28:56 Top
Nicholas Glasier


Guest


Hi Dmitry,

I was setting the position first. It seems to be fixed using the following code to take into account the fact that the first time there won't be any settings saved.

BarPos := fIniFile.ReadInteger('Options', 'BarPos',0);

// Tried using 5 (adxMsofloating) as the default value
// but that's what caused the error.

if BarPos = 0 then
MyCmndBar.Position := adxMsoBarFloating
else
MyCmndBar.Position := TadxMsoBarPosition(BarPos);

MyCmndBar.RowIndex := fIniFile.ReadInteger('Options', 'Row', -1);
MyCmndBar.CommandBarTop := fIniFile.ReadInteger('Options', 'Top', -1);
MyCmndBar.CommandBarLeft := fIniFile.ReadInteger('Options', 'Left', -1);

Word does seem to flicker a lot when the bar is being built, like Word is adding and then removing an additional row at the bottom of the toolbar.

Regards Nick
Posted 02 Nov, 2005 15:15:55 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Nicholas,

From our experience I can say that Word is the slowest host application when it comes to working with command bars and command bar controls.


Posted 03 Nov, 2005 06:59:14 Top