• Login
sketchucation logo sketchucation
  • Login
πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

[code] Win32 Moving/Showing/Hiding Toolbars and Dialogs

Scheduled Pinned Locked Moved Developers' Forum
91 Posts 8 Posters 15.9k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    Jim
    last edited by 23 Oct 2010, 04:32

    @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. πŸ‘

    Hi

    1 Reply Last reply Reply Quote 0
    • T Offline
      thomthom
      last edited by 23 Oct 2010, 09:34

      @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. πŸ˜„

      Thomas Thomassen β€” SketchUp Monkey & Coding addict
      List of my plugins and link to the CookieWare fund

      1 Reply Last reply Reply Quote 0
      • T Offline
        thomthom
        last edited by 26 Dec 2010, 13:45

        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-aa767d841d20

        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.

        Thomas Thomassen β€” SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • T Offline
          thomthom
          last edited by 26 Dec 2010, 13:51

          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"?

          Thomas Thomassen β€” SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          1 Reply Last reply Reply Quote 0
          • T Offline
            thomthom
            last edited by 26 Dec 2010, 13:58

            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-flag

            But 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.

            Thomas Thomassen β€” SketchUp Monkey & Coding addict
            List of my plugins and link to the CookieWare fund

            1 Reply Last reply Reply Quote 0
            • H Offline
              honoluludesktop
              last edited by 26 Dec 2010, 14:48

              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.

              1 Reply Last reply Reply Quote 0
              • T Offline
                thomthom
                last edited by 26 Dec 2010, 15:12

                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?

                Thomas Thomassen β€” SketchUp Monkey & Coding addict
                List of my plugins and link to the CookieWare fund

                1 Reply Last reply Reply Quote 0
                • H Offline
                  honoluludesktop
                  last edited by 26 Dec 2010, 17:37

                  Yes, Would go a long way to cleaning up our screens.

                  1 Reply Last reply Reply Quote 0
                  • T Offline
                    thomthom
                    last edited by 26 Dec 2010, 17:53

                    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.

                    Thomas Thomassen β€” SketchUp Monkey & Coding addict
                    List of my plugins and link to the CookieWare fund

                    1 Reply Last reply Reply Quote 0
                    • H Offline
                      honoluludesktop
                      last edited by 26 Dec 2010, 18:44

                      @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.

                      1 Reply Last reply Reply Quote 0
                      • T Offline
                        thomthom
                        last edited by 26 Dec 2010, 18:49

                        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.

                        Thomas Thomassen β€” SketchUp Monkey & Coding addict
                        List of my plugins and link to the CookieWare fund

                        1 Reply Last reply Reply Quote 0
                        • Dan RathbunD Offline
                          Dan Rathbun
                          last edited by 26 Dec 2010, 22:24

                          @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.

                          I'm not here much anymore.

                          1 Reply Last reply Reply Quote 0
                          • T Offline
                            thomthom
                            last edited by 27 Dec 2010, 15:08

                            @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-aa767d841d20

                            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.

                            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 the WS_EX_NOACTIVATE bits appear to be set.

                            ❓ ❓

                            Thomas Thomassen β€” SketchUp Monkey & Coding addict
                            List of my plugins and link to the CookieWare fund

                            1 Reply Last reply Reply Quote 0
                            • Dan RathbunD Offline
                              Dan Rathbun
                              last edited by 27 Dec 2010, 18:08

                              WebDialogs are child windows of the SU app window.

                              The Notepad window is a toplevel window.

                              I'm not here much anymore.

                              1 Reply Last reply Reply Quote 0
                              • T Offline
                                thomthom
                                last edited by 27 Dec 2010, 18:37

                                Does that matter?
                                Floating toolbars are also child of the SU window...

                                Thomas Thomassen β€” SketchUp Monkey & Coding addict
                                List of my plugins and link to the CookieWare fund

                                1 Reply Last reply Reply Quote 0
                                • T Offline
                                  thomthom
                                  last edited by 27 Dec 2010, 19:01

                                  Sidenote: Win32 - Get SketchUp Window Handle

                                  Thomas Thomassen β€” SketchUp Monkey & Coding addict
                                  List of my plugins and link to the CookieWare fund

                                  1 Reply Last reply Reply Quote 0
                                  • Dan RathbunD Offline
                                    Dan Rathbun
                                    last edited by 27 Dec 2010, 21:35

                                    @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.

                                    I'm not here much anymore.

                                    1 Reply Last reply Reply Quote 0
                                    • T Offline
                                      thomthom
                                      last edited by 28 Dec 2010, 00:12

                                      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.

                                      Thomas Thomassen β€” SketchUp Monkey & Coding addict
                                      List of my plugins and link to the CookieWare fund

                                      1 Reply Last reply Reply Quote 0
                                      • D Offline
                                        driven
                                        last edited by 28 Dec 2010, 16:17

                                        @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

                                        learn from the mistakes of others, you may not live long enough to make them all yourself...

                                        1 Reply Last reply Reply Quote 0
                                        • T Offline
                                          thomthom
                                          last edited by 28 Dec 2010, 16:47

                                          @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?

                                          Thomas Thomassen β€” SketchUp Monkey & Coding addict
                                          List of my plugins and link to the CookieWare fund

                                          1 Reply Last reply Reply Quote 0
                                          • 1
                                          • 2
                                          • 3
                                          • 4
                                          • 5
                                          • 3 / 5
                                          • First post
                                            Last post
                                          Buy SketchPlus
                                          Buy SUbD
                                          Buy WrapR
                                          Buy eBook
                                          Buy Modelur
                                          Buy Vertex Tools
                                          Buy SketchCuisine
                                          Buy FormFonts

                                          Advertisement