@jim said:
Just messing around with the Toolbar entries in the registry to see if there might be a way to reset their positions.
Conclusion: Changing values in registry while SU is running has no effect. SU only reads from the registry on startup, and writes to it only on shutdown.
(1) This means the registry probably does not contain the current position of a toolbar if it's moved during a session.
(2) This means (on the up side,) that you can set up your toolbars the way you like (and they work,) then shutdown SU, and backup those registry keys for the toolbars to a .reg file. [You will likely have to export each key and then append all the files into one. Also possibly, you'd need to add a command at the top of the file to delete all 'ToolbarsUser-*' keys.] Once you have the .reg file, you can use it to restore the toolbars settings back to the optimum layout if they get messed up, etc. EDIT['con' changed to 'up']
@jim said:
... I have been opening and closing toolbars and sketchup all day, and can see no patterns. I was hoping to see some way to detect and set a toolbar's (x, y) position. The toolbar registry entries do have XPos and YPos values, but I can't find a clear connection between them and the toolbar's actual position.
XPos and MRUDockLeftPos are basically the Xorigin of the toolbar, with respect to the origin of it's Container when Docked. But.. XPos may be the 'last' setting, and MRU... the historical or previous setting. (Generally the MRU attributes are there to put a toolbar back where it was after it was turned off, and then turned on again.) I'm guessing a bit here.. however, I noticed that some toolbars update both values, other toolbars do not. So it may be as simple as, there have been several programmers, over the years working on this feature, and it may be the ol' righthand/lefthand scenario. (Bugs may have creeped in.)
YPos and MRUDockTopPos are basically the Yorigin of the toolbar, with respect to the origin of it's Container when Docked. (same notes apply as to the Docked X position values.)
MRUDockRightPos is the Righthand end of the toolbar, with respect to the origin of it's Container when Docked. (Left-Right should give the width of the toolbar.)
MRUDockBottomPos is the bottom edge of the toolbar, with respect to the origin of it's Container when Docked. (Top-Bottom should give the heigth of the toolbar.)
- I note that in many cases, instead of using a value of 0, we get a value that is 1 less than the max integer value for a 32bit number.* ie: 0xFFFFFFFE (4294967294) = 0 - 1* This may be an error. (The C-type may be UINT [unsigned integer] and subtracting 1 makes it 'rollunder.')* It seems in most X/Y values, the position of the next toolbar, is set 1 less than the dimension of the previous toolbar, instead of 1 more than.
MRUFloatXPos should be the X position with respect to the Display Screen origin.
MRUFloatYPos should be the Y position with respect to the Display Screen origin.
-
However we see strange values, perhaps positioning codes, two examples:
-
0x80000000 (2147483648)* 0xF8DB0000 (4175101952)* Add to that the duplicate registry record that gets created when you pull a toolbar off a container, and float it.
Moving Toolbars
In Win32 programming, everything on the screen, is a 'window'. Specifically all items are subclasses of class Window, and inherit base methods, etc. (So even a button is a window, that happens to have an image that makes it look like a button.)
Floating: When toolbars are floated, they are basically re-styled as a non-modal dialog subclass; and re-adopted as a direct child of the application window (Sketchup's window.)
So, Jim, you should be able to move them around in the same way you did the Console window, using Win32 API calls.
Docked: When docked, they are re-adopted as a child window of the Toolbar Container Window, and restyled so as not to have frames, no caption bar, and add grips. If the caption names are not changed, you may be able to use the same methods you use for moving floating bars, just compensate for the different origins. (Screen origin vs the origins of the individual toolbar containers.)