[code] Win32 Moving/Showing/Hiding Toolbars and Dialogs
-
@thomthom said:
I some times experience that the window automatically closes after a few seconds. it has happened only sporadically...)
It's just getting GC'd.
window
is a local variable referencing the WebDialog, and the variable no longer exists after the method exits. Since the WebDialog no longer has any references, it is GC'd.@thomthom said:
Can GWL_STYLE and GWL_EXSTYLE changes be combines into one call?
Maybe - the "styles" are just bits but at different offset (one is -16, the other -20). If you meant is there a win32api function for setting both simultaneously then I don't know.
Hehe, the php highlighter work OK on Ruby.
-
@jim said:
It's just getting GC'd. window is a local variable referencing the WebDialog, and the variable no longer exists after the method exits. Since the WebDialog no longer has any references, it is GC'd.
Oh... that's a gotcha I didn't think of. You need to keep a reference to the WD for the duration of its lifespan.
@jim said:
Maybe - the "styles" are just bits but at different offset (one is -16, the other -20). If you meant is there a win32api function for setting both simultaneously then I don't know.
The thing is - today, I don't really see any lag...
What's nice about having toolwindows is that now I can make my custom toolbar.
-
Just came across a nice API call that will be useful for creating webdialog toolbars:
http://social.msdn.microsoft.com/forums/en/csharpgeneral/thread/e7fef568-2c0b-41eb-9785-304f84d03819/#bf79c87e-ef49-456f-a485-aa767d841d20One can use
WS_EX_NOACTIVATE
to prevent a window from catching focus - but from what I understand it'll still allow interaction events. I'll try it out as soon as I get home. -
hm....
@unknownuser said:
The WS_EX_NOACTIVATE value for dwExStyle prevents foreground activation by the system. To prevent queue activation when the user clicks on the window, you must process the WM_MOUSEACTIVATE message appropriately. To bring the window to the foreground or to activate it programmatically, use SetForegroundWindow or SetActiveWindow. Returning FALSE to WM_NCACTIVATE prevents the window from losing queue activation. However, the return value is ignored at activation time.
http://msdn.microsoft.com/en-us/library/ms632680%28v=vs.85%29.aspx
"queue activation"?
-
bleh... turns out to not be so straight forwards as I though. Seems that one needs to handle some window messages:
http://www.allquests.com/question/132471/Ws-ex-noactivate.html
http://stackoverflow.com/questions/2969680/c-showing-form-with-ws-ex-noactivate-flagBut working out how to handle window messages would be a very interesting thing - as then we could recreate the roll-up/down feature of SU's toolwindows.
-
tt, most of this discussion is "over my head", but will the result permit toolbars to unfold perpendicular to the edge of a sketchup window like the menus do? If so please provide a simple version that we can use to compact our application toolbars.
-
It doesn't modify existing toolbars. I'm simply modifying the appearance of webdialogs.
@honoluludesktop said:
but will the result permit toolbars to unfold perpendicular to the edge of a sketchup window like the menus do?
You mean toolbars where you click on a button and it displays a dropdown list of more buttons?
-
Yes, Would go a long way to cleaning up our screens.
-
Interesting though - but I'm not sure if it's possible. In either case - if you start making all toolbars like that they end up having the same problem as menus - that everything is hidden in sub-menus and you need an extra operation to reveal it - to be able to explore available commands. I feel the usability would not be improved.
If one has that many toolbars open I'd rather ask if they are all required to be there on screen.
Personally I assign hotkeys to the most frequent commands I use. Then I have a few toolbars for semi-frequent command. For everything else I use the menus.
I have been toying with the idea of having a webdialog which allows you to filter out the commands you want - and make sets of tools you can switch between depending on the job.
-
@thomthom said:
...........if you start making all toolbars like that they end up having the same problem as menus - that everything is hidden in sub-menus and you need an extra operation to reveal it - to be able to explore available commands. I feel the usability would not be improved.
.........You are probably right about this.
-
I do have an experimental hack to catch all menus, commands and toolbar items that's created. I hope to tind time soon to put together a basic version of a plugin that let you quickly search and filter out available commands.
-
@thomthom said:
@honoluludesktop said:
but will the result permit toolbars to unfold perpendicular to the edge of a sketchup window like the menus do?
You mean toolbars where you click on a button and it displays a dropdown list of more buttons?
These are called "Flyout Toolbars" and have been a part of the AutoCAD GUI since at least R13 (circa 1994) and perhaps even R12 in Win16 mode.
This is one of the things on my to do list for Win32 Sketchup.
-
@thomthom said:
Just came across a nice API call that will be useful for creating webdialog toolbars:
http://social.msdn.microsoft.com/forums/en/csharpgeneral/thread/e7fef568-2c0b-41eb-9785-304f84d03819/#bf79c87e-ef49-456f-a485-aa767d841d20One can use
WS_EX_NOACTIVATE
to prevent a window from catching focus - but from what I understand it'll still allow interaction events. I'll try it out as soon as I get home.Just had a go at this. I could not get a webdialog to not get any focus when I set
WS_EX_NOACTIVATE
- but I could make a Notepad window to change. I don't understand why.
When I check the EX_STYLES of the webdialog theWS_EX_NOACTIVATE
bits appear to be set. -
WebDialogs are child windows of the SU app window.
The Notepad window is a toplevel window.
-
Does that matter?
Floating toolbars are also child of the SU window... -
Sidenote: Win32 - Get SketchUp Window Handle
-
@thomthom said:
Does that matter?
Well.. you you didnt understand why...
I propose the flag acts differently for child windows versus toplevel windows... it's the only difference I can see at first glance.
-
Yea, I was looking at that myself, but when comparing to the floating toolbars I could not see any significant difference. But I'm not that familiar with Win32 API.
-
@thomthom said:
One can use
WS_EX_NOACTIVATE
to prevent a window from catching focus - but from what I understand it'll still allow interaction events. I'll try it out as soon as I get home.hi Thomas,
been trying to make a 'nice' Mac toolbar in a WebDialog, and discovered that if you hold down the cmd key (i.e. before clicking the tool icon) you don't move focus and the tool (and cursor image) is there immediately on mouse-out.
This is one click LESS than on a standard mac SU toolbar icons as I don't have to click back into the model space to activate the cursor.... (command clicking SU toolbar icons does the same thing, as well)
so, question is, do you have a snippet that will send a cmd_key_down on mouse-over of the WD?john
-
@driven said:
been trying to make a 'nice' Mac toolbar in a WebDialog, and discovered that if you hold down the cmd key (i.e. before clicking the tool icon) you don't move focus and the tool (and cursor image) is there immediately on mouse-out.
This is one click LESS than on a standard mac SU toolbar icons as I don't have to click back into the model space to activate the cursor....Are you saying that clicking a native toolbar button in SU steals focus from the main window? (I need to unpack my Mac from my moving-boxes to have a look at this.)
@driven said:
so, question is, do you have a snippet that will send a cmd_key_down on mouse-over of the WD?
I've never developed for OSX - so this is unknown territory for me. But will you even be able to receive mouse events if the window haven't got focus?
Advertisement