tags:

views:

57

answers:

1
+1  Q: 

dragging toolbars

I created in my app 2 toolbars. Because I wanted to be able to drag them, I put both TToolBar components inside a TControlBar. I this case I can move them, but I want to be able to drag them like in MS Office (drag a toolbar from top and put it left, right or at bottom of the window and save it's position)....

Can anyone help me out?

+1  A: 

Set 'DragKind' of the ToolBars to 'dkDock', and 'DragMode' to 'dmAutomatic'. 'DockSite' of the ControlBars should be True. Now all you need is to hold on sth. to drag, for some reason the drag handles does not seem to work, but seperators would do. Perhaps a seperator as a first item would fake a drag handle.

For test purposes compile and run the 'Docking Demo' in '...\Demos\DelphiWin32\VCLWin32\Docking' folder. You should be able to float 'Toolbar1' by dragging from the separator between 'Exit' and 'Toolbar1' buttons.

As for saving the position, I believe you would do that manually

Having said these, IMO, these controls would not make for good GUI elements. As far as I know the Office applications have never used the ToolbarWindow32 and Rebar controls. Go for a 3rd party library instead. I am using a SpTBXLib library which depends on Toolbar2000.

Sertac Akyuz