• 登入
sketchucation logo sketchucation
  • 登入
⚠️ Libfredo 15.4b | Minor release with bugfixes and improvements Update

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

已排程 已置頂 已鎖定 已移動 Developers' Forum
91 貼文 8 Posters 15.9k 瀏覽 8 Watching
正在載入更多貼文
  • 從舊到新
  • 從新到舊
  • 最多點贊
回覆
  • 在新貼文中回覆
登入後回覆
此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
  • J 離線
    Jim
    最後由 編輯 2010年10月23日 上午4:27

    @pout said:

    What are possible advantages of using toolwindows instead of webdialogs?
    And is the communication between SU and the toolwindow still done in the same way?

    For some windows, if it is a Toolwindow it will not show up in the Alt-Tab list. But this is normal for SketchUp dialog windows anyway, so there should be no difference there.

    Hi

    1 條回覆 最後回覆 回覆 引用 0
    • J 離線
      Jim
      最後由 編輯 2010年10月23日 上午4: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 條回覆 最後回覆 回覆 引用 0
      • T 離線
        thomthom
        最後由 編輯 2010年10月23日 上午9: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 條回覆 最後回覆 回覆 引用 0
        • T 離線
          thomthom
          最後由 編輯 2010年12月26日 下午1: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 條回覆 最後回覆 回覆 引用 0
          • T 離線
            thomthom
            最後由 編輯 2010年12月26日 下午1: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 條回覆 最後回覆 回覆 引用 0
            • T 離線
              thomthom
              最後由 編輯 2010年12月26日 下午1: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 條回覆 最後回覆 回覆 引用 0
              • H 離線
                honoluludesktop
                最後由 編輯 2010年12月26日 下午2: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 條回覆 最後回覆 回覆 引用 0
                • T 離線
                  thomthom
                  最後由 編輯 2010年12月26日 下午3: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 條回覆 最後回覆 回覆 引用 0
                  • H 離線
                    honoluludesktop
                    最後由 編輯 2010年12月26日 下午5:37

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

                    1 條回覆 最後回覆 回覆 引用 0
                    • T 離線
                      thomthom
                      最後由 編輯 2010年12月26日 下午5: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 條回覆 最後回覆 回覆 引用 0
                      • H 離線
                        honoluludesktop
                        最後由 編輯 2010年12月26日 下午6: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 條回覆 最後回覆 回覆 引用 0
                        • T 離線
                          thomthom
                          最後由 編輯 2010年12月26日 下午6: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 條回覆 最後回覆 回覆 引用 0
                          • Dan RathbunD 離線
                            Dan Rathbun
                            最後由 編輯 2010年12月26日 下午10: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 條回覆 最後回覆 回覆 引用 0
                            • T 離線
                              thomthom
                              最後由 編輯 2010年12月27日 下午3: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 條回覆 最後回覆 回覆 引用 0
                              • Dan RathbunD 離線
                                Dan Rathbun
                                最後由 編輯 2010年12月27日 下午6:08

                                WebDialogs are child windows of the SU app window.

                                The Notepad window is a toplevel window.

                                I'm not here much anymore.

                                1 條回覆 最後回覆 回覆 引用 0
                                • T 離線
                                  thomthom
                                  最後由 編輯 2010年12月27日 下午6: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 條回覆 最後回覆 回覆 引用 0
                                  • T 離線
                                    thomthom
                                    最後由 編輯 2010年12月27日 下午7:01

                                    Sidenote: Win32 - Get SketchUp Window Handle

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

                                    1 條回覆 最後回覆 回覆 引用 0
                                    • Dan RathbunD 離線
                                      Dan Rathbun
                                      最後由 編輯 2010年12月27日 下午9: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 條回覆 最後回覆 回覆 引用 0
                                      • T 離線
                                        thomthom
                                        最後由 編輯 2010年12月28日 上午12: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 條回覆 最後回覆 回覆 引用 0
                                        • D 離線
                                          driven
                                          最後由 編輯 2010年12月28日 下午4: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 條回覆 最後回覆 回覆 引用 0
                                          • 1
                                          • 2
                                          • 3
                                          • 4
                                          • 5
                                          • 3 / 5
                                          • 第一個貼文
                                            最後的貼文
                                          Buy SketchPlus
                                          Buy SUbD
                                          Buy WrapR
                                          Buy eBook
                                          Buy Modelur
                                          Buy Vertex Tools
                                          Buy SketchCuisine
                                          Buy FormFonts

                                          Advertisement