Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

GUIFrame UDF - Melba23 version - 19 May 14


  • Please log in to reply
134 replies to this topic

#41 CMJ

CMJ

    Seeker

  • Active Members
  • 35 posts

Posted 07 July 2011 - 06:39 PM

Melba23,

If I could presume to make a suggestion...

In GUIFrame.au3 Line 582 you use this statment:

If StringInStr(@OSArch, "64") Then


I was running into a problem when I was compiling my code as an x86 application but running it on a 64bit machine. It will throw an array error every time. Replacing that line with this one has fixed the error.

If @AutoItX64 = 1 Then


Any reason this would not work? Either way, I thought I would mention it in case anyone else is having the same problem. Thanks again for a great UDF.

Cheers,
cj







#42 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 21,139 posts

Posted 08 July 2011 - 10:41 AM

CMJ,

The gurus who understand x86/x64 differences tell me that your solution is fine so I will incorproate it in the next update. :)

Thanks for the pointer (no pun intended!). ;)

M23
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#43 DragonBall

DragonBall

    Seeker

  • Active Members
  • 44 posts

Posted 02 December 2011 - 02:08 PM

I use Melba23's GUIFrame UDF, it works pretty well. But I got 2 questions. First, when I hold the separator bar and move it, the background ( if it's colored ) will flash. If I move it very very slowly, then no flash. If I hold the edge side of the whole window to resize the whole window, then no flash occur. How to avoid flash if I drag the separator bar?

Second, if I drag the right edge side of the whole window, then the frames in the right are resized, but not the frames in the left, since the separator bar is fixed. Sometimes, I need to resize the frames in the left and right at the same time, for example, I need the 2 frames have equal size. So it would looks like that, if I drag the left edge of the whole window, then, the position is fixed, but the separator bar will move, which is at the middle of the window, and both 2 frames are resize to half of the window.
I have played with this UDF a little, but it's not easy to figure out how could do this ( in a short time..... )

The following is just from Melba23's examples, with only two frames, one in left, one in right.


AutoIt         
#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include "GUIFrame.au3" Global $iSep_Pos $hGUI = GUICreate("GUI_Frame Example 2", 500, 500, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX)) GUISetState() ; Register WM_SIZE to simulate the script requiring it GUIRegisterMsg($WM_SIZE, "_WM_SIZE") ; Create a 1st level frame $iFrame_A = _GUIFrame_Create($hGUI) _GUIFrame_SetMin($iFrame_A, 50, 100) _GUIFrame_Switch($iFrame_A, 2) $aWinSize = WinGetClientSize(_GUIFrame_GetHandle($iFrame_A, 2)) GUICtrlCreateLabel("", 5, 5, $aWinSize[0] - 10, $aWinSize[1] - 10) GUICtrlSetBkColor(-1, 0xFF0000) GUICtrlSetState(-1, $GUI_DISABLE) _GUIFrame_Switch($iFrame_A, 1) $aWinSize = WinGetClientSize(_GUIFrame_GetHandle($iFrame_A, 2)) GUICtrlCreateLabel("", 5, 5, $aWinSize[0] - 10, $aWinSize[1] - 10) GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlSetState(-1, $GUI_DISABLE) _GUIFrame_ResizeSet(0) ; DO NOT Register the $WM_SIZE handler to permit resizing as the message is already registered ;_GUIFrame_ResizeReg() While 1 Switch GUIGetMsg()   Case $GUI_EVENT_CLOSE    ; The UDF does all the tidying up as you exit    Exit EndSwitch WEnd ; This is the already registered WM_SIZE handler Func _WM_SIZE($hWnd, $iMsg, $wParam, $lParam)     ; Just call the GUIFrame resizing function here - do NOT use the _GUIFrame_ResizeReg function in the script     _GUIFrame_SIZE_Handler($hWnd, $iMsg, $wParam, $lParam)     Return "GUI_RUNDEFMSG" EndFunc


#44 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 21,139 posts

Posted 02 December 2011 - 02:23 PM

hodgestructure,

it works pretty well

I shall interpret that comment as English understatement - and so thank you for your fulsome praise! :)

- 1. Interestingly I get the reverse symptoms to you - the frames flash a a lot when I resize the GUI itself but I get no flashing at all when I move the separator bar at whatever speed. I assume that it is something to do with the specific graphic adapator used and I have no idea how to prevent it. :rip:

- 2. You can use the _GUIFrame_SetSepPos function to set the separator position - I would suggest putting it in the WM_SIZE handler like this:
; This is the already registered WM_SIZE handler Func _WM_SIZE($hWnd, $iMsg, $wParam, $lParam)         ; Just call the GUIFrame resizing function here - do NOT use the _GUIFrame_ResizeReg function in the script     _GUIFrame_SIZE_Handler($hWnd, $iMsg, $wParam, $lParam)     ; Get new width of GUI     Local $iGUIWidth = BitAND($lParam, 0xFFFF)     ; Set separator to mid position     _GUIFrame_SetSepPos($iFrame_A, $iGUIWidth / 2)     Return "GUI_RUNDEFMSG" EndFunc   ;==>_WM_SIZE

And the separator bar stays in the middle of the resizing GUI. :D

M23

P.S. Any particular reason you did not post this in the UDF thread itself? :oops:
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#45 DragonBall

DragonBall

    Seeker

  • Active Members
  • 44 posts

Posted 02 December 2011 - 03:43 PM

Hi, Melba23,



After some efforts, I could get the separator bar in the middle , but not in a good way. I totally didn't recoginze that you provide _GUIFrame_SetSepPos.....................!! Thank you!!


I didn't know that it should be better to ask this question in the UDF thread itself, sorry....

And does "pretty well" is a understatement in English?? I am not good in English....

#46 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 21,139 posts

Posted 02 December 2011 - 04:06 PM

hodgestructure,

And does "pretty well" is a understatement in English?? I am not good in English

Your choice of words made it sound as if you were not very pleased with the UDF, but English people often say such things even if they think things are really very good - that is known as "understatement". I was making a small joke with my very English sense of humour - do not worry about it. :oops:

A small change to the code I posted above - we need to make sure it is only the main GUI resizing that changes the position of the separator:
Func _WM_SIZE($hWnd, $iMsg, $wParam, $lParam)     ; Just call the GUIFrame resizing function here - do NOT use the _GUIFrame_ResizeReg function in the script     _GUIFrame_SIZE_Handler($hWnd, $iMsg, $wParam, $lParam)     ; Check it is the main GUI resizing     If $hWnd = $hGUI Then         ; Get new width of GUI         Local $iGUIWidth = BitAND($lParam, 0xFFFF)         ; Set separator to mid position         _GUIFrame_SetSepPos($iFrame_A, $iGUIWidth / 2)     EndIf     Return "GUI_RUNDEFMSG" EndFunc   ;==>_WM_SIZE

Otherwise we get problem if we resize the frames with the separator bar. :D

M23
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#47 DragonBall

DragonBall

    Seeker

  • Active Members
  • 44 posts

Posted 02 December 2011 - 05:36 PM

Finally, use your script and combine other stuff, I could make the following result:

Posted Image


But may as you mentioned above, there is some problem about specific graphic adapator, after move or resize the programs embedded as child windows of the frames, some parts will dispear, and other problems, just like:


Posted Image


This may or may not be the problem of AutoIt, but I wish one day, this problem will disapper!!

#48 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 21,139 posts

Posted 02 December 2011 - 05:42 PM

hodgestructure,

Others (including me!) have successfully used this UDF without that problem on move/resize. Please post your code so I can take a look. :D

M23
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#49 DragonBall

DragonBall

    Seeker

  • Active Members
  • 44 posts

Posted 02 December 2011 - 06:07 PM

Hi, Melba 23, here is my script. I use _WinAPI_SetParent and _WinAPI_SetWindowPos to embed 2 programs into 2 frames created by your UDF. The problem occurs when I want to move the programs windows or resize it ( even no resize the frames and no resize of the GUI, just resize the programs window). The programs window sometimes even disappear, but if I click the frame again and wait for a while , the window come back. If no resize of programs windows, only resize of frames and GUI, then no problem.


Thank you for your nice help


(I order to make it work, I need to add two more global variables in you GUIFrame.au3, but not important to this qeustion.)




AutoIt         
#include #include #include "GUIFrame.au3" #include #include #include #include ;;====================================== #include #include #include ;;====================================== Global $iSep_Pos ;; $hGUI = GUICreate("GUI_Frame Example 2", 800, 600, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX)) GUISetState() ; Register WM_SIZE to simulate the script requiring it GUIRegisterMsg($WM_SIZE, "_WM_SIZE") ; Create a 1st level frame $iFrame_A = _GUIFrame_Create($hGUI) _GUIFrame_SetMin($iFrame_A, 50, 100) _GUIFrame_Switch($iFrame_A, 2) $aWinSize = WinGetClientSize(_GUIFrame_GetHandle($iFrame_A, 2)) GUICtrlCreateLabel("", 5, 5, $aWinSize[0] - 10, $aWinSize[1] - 10) ;GUICtrlSetBkColor(-1, 0xFF0000) GUICtrlSetState(-1, $GUI_DISABLE) _GUIFrame_Switch($iFrame_A, 1) $aWinSize = WinGetClientSize(_GUIFrame_GetHandle($iFrame_A, 2)) GUICtrlCreateLabel("", 5, 5, $aWinSize[0] - 10, $aWinSize[1] - 10) ;GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlSetState(-1, $GUI_DISABLE) $hGUI_Size = WinGetClientSize($hGUI) $hGUI_Handle = WinGetHandle($hGUI) $iFrame_A_Size = WinGetClientSize($iFrame_A) $iFrame_A_Handle = WinGetHandle($iFrame_A) $iFrame_A1_Handle = _GUIFrame_GetHandle($iFrame_A, 1) $iFrame_A1_Size = WinGetPos($iFrame_A1_Handle) $iFrame_A2_Handle = _GUIFrame_GetHandle($iFrame_A, 2) $iFrame_A2_Size = WinGetPos($iFrame_A2_Handle) WinWait("WinEdt 6.0") ControlClick("WinEdt 6.0", "C:UsersimoDesktopDocumentg3g3.tex", "[CLASS:TToolBar; INSTANCE:3]", "left", 1, 432, 13) ;;$_WinEdt_Pos_Size = WinGetPos("[CLASS:TMainForm]") ;;$_WinEdt_Pos_X = $_WinEdt_Pos_Size[0] + $_WinEdt_Pos_Size[2]/2 ;;$_WinEdt_Pos_Y = $_WinEdt_Pos_Size[1] + $_WinEdt_Pos_Size[3]/2 ;;$_WinEdt_App_Handle = DllCall("user32.dll", "int", "WindowFromPoint", "long", $_WinEdt_Pos_X , "long", $_WinEdt_Pos_Y ) ;;$_WinEdt_Parent_Handle = _WinAPI_GetAncestor( $_WinEdt_App_Handle[0], $GA_ROOT ) ;; $hWnd3 = $_WinEdt_Parent_Handle $hWnd_WinEdt = WinGetHandle("[CLASS:TMainForm]") _GUICtrlMenu_SetMenu($hWnd_WinEdt,1) WinWait("[CLASS:SUMATRA_PDF_FRAME]") $hWnd_SumatraPDF = WinGetHandle("[CLASS:SUMATRA_PDF_FRAME]") $SumatraPDFPID = WinGetProcess("[CLASS:SUMATRA_PDF_FRAME]") _GUICtrlMenu_SetMenu($hWnd_SumatraPDF,1) _WinAPI_SetParent($hWnd_WinEdt, $iFrame_A1_Handle) _WinAPI_SetWindowPos($hWnd_WinEdt,$HWND_TOP,0,0 ,$iFrame_A1_Size[2],$iFrame_A1_Size[3],$SWP_SHOWWINDOW) _WinAPI_SetParent($hWnd_SumatraPDF, $iFrame_A2_Handle) _WinAPI_SetWindowPos($hWnd_SumatraPDF,$HWND_TOP,0,0 ,$iFrame_A2_Size[2],$iFrame_A2_Size[3],$SWP_SHOWWINDOW) _GUIFrame_ResizeSet(0) ; DO NOT Register the $WM_SIZE handler to permit resizing as the message is already registered ;_GUIFrame_ResizeReg() While 1 Switch GUIGetMsg()   Case $GUI_EVENT_CLOSE    ; The UDF does all the tidying up as you exit    Exit EndSwitch   $hGUI_Size = WinGetClientSize($hGUI)   Sleep(1000)   ;WinMove($hParent_Handle,"", 0,0, $hGUI_Size[0],$hGUI_Size[1])   ;WinMove($Separator_Handle,"", $hGUI_Size[0]/2,0, 10,$hGUI_Size[1])   ;WinMove($iFrame_A1_Handle,"",0,0, $hGUI_Size[0]/2,$hGUI_Size[1])      ;WinMove($iFrame_A2_Handle,"", $hGUI_Size[0]/2, 0,$hGUI_Size[0]/2,$hGUI_Size[1])   Sleep(1000)   $iFrame_A2_Size = WinGetPos($iFrame_A1_Handle)   $iFrame_A2_Size = WinGetPos($iFrame_A2_Handle)   Sleep(1000)         ;_WinAPI_SetWindowPos($hWnd_WinEdt,$HWND_TOP,0,0 ,$iFrame_A1_Size[2],$iFrame_A1_Size[3],$SWP_SHOWWINDOW)         ;_WinAPI_SetWindowPos($hWnd_SumatraPDF,$HWND_TOP,0,0 ,$iFrame_A2_Size[2],$iFrame_A2_Size[3],$SWP_SHOWWINDOW) WEnd ; This is the already registered WM_SIZE handler Func _WM_SIZE($hWnd, $iMsg, $wParam, $lParam)     ; Just call the GUIFrame resizing function here - do NOT use the _GUIFrame_ResizeReg function in the script     ;_GUIFrame_SIZE_Handler($hWnd, $iMsg, $wParam, $lParam)     Return "GUI_RUNDEFMSG" EndFunc

Edited by hodgestructure, 02 December 2011 - 06:12 PM.


#50 DragonBall

DragonBall

    Seeker

  • Active Members
  • 44 posts

Posted 02 December 2011 - 06:19 PM

If I embed the programs into a normal window ( not into a child window, like frames, of a Main GUI), then moving and resize the program widnows have no problems. But in this case, i can't use separator bar to resize them.....and doesn't look good this way.

Posted Image

#51 DragonBall

DragonBall

    Seeker

  • Active Members
  • 44 posts

Posted 02 December 2011 - 07:16 PM

OK, I found the problem should be I embedd the programs into a level 3 window ( Main --> FrameParent --> Frame --> Programs). Even embed in a level 2 window will cause the problem ( Main ---> Child --> Programs) will cause the same problem....

#52 Valik

Valik

    Former developer.

  • Active Members
  • PipPipPipPipPipPip
  • 18,879 posts

Posted 02 December 2011 - 07:26 PM

Melba, do you still want this thread merged with your topic given the length this topic has grown to?

#53 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 21,139 posts

Posted 02 December 2011 - 07:46 PM

Valik,

I think it is still worth merging if you do not mind doing so - there are some points here which would be useful to anyone else reading about the UDF. :D

hodgestructure,

I have rewritten the script you posted and this version works fine for me with 2 of my apps: :rip:
AutoIt         
#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <Constants.au3> #include "GUIFrame.au3" ; Get the 2 apps ready WinWait("EditPad Classic") $hWnd_EditPad = WinGetHandle("EditPad Classic") WinWait("Untitled - Notepad") $hWnd_NotePad = WinGetHandle("Untitled - Notepad") ; Create the GUI $hGUI = GUICreate("GUI_Frame Example 2", 800, 600, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX)) ; Create a 1st level frame $iFrame_A = _GUIFrame_Create($hGUI) $hFrame_A1_Handle = _GUIFrame_GetHandle($iFrame_A, 1) $iFrame_A1_Size = WinGetPos($hFrame_A1_Handle) $hFrame_A2_Handle = _GUIFrame_GetHandle($iFrame_A, 2) $iFrame_A2_Size = WinGetPos($hFrame_A2_Handle) GUISetState() ; Register WM_SIZE to simulate the script requiring it GUIRegisterMsg($WM_SIZE, "_WM_SIZE") _GUIFrame_ResizeSet(0) ; Set the apps as children to the frames _WinAPI_SetParent($hWnd_EditPad, $hFrame_A1_Handle) _WinAPI_SetWindowPos($hWnd_EditPad, $HWND_TOP, 0, 0, $iFrame_A1_Size[2], $iFrame_A1_Size[3], $SWP_SHOWWINDOW) _WinAPI_SetParent($hWnd_NotePad, $hFrame_A2_Handle) _WinAPI_SetWindowPos($hWnd_NotePad, $HWND_TOP, 0, 0, $iFrame_A2_Size[2], $iFrame_A2_Size[3], $SWP_SHOWWINDOW) While 1     Switch GUIGetMsg()         Case $GUI_EVENT_CLOSE             Exit     EndSwitch WEnd ; This is the already registered WM_SIZE handler Func _WM_SIZE($hWnd, $iMsg, $wParam, $lParam)     _GUIFrame_SIZE_Handler($hWnd, $iMsg, $wParam, $lParam)     Switch $hWnd         Case $hGUI             ; Get new width of GUI             Local $iGUIWidth = BitAND($lParam, 0xFFFF)             ; Set separator to mid position             _GUIFrame_SetSepPos($iFrame_A, $iGUIWidth / 2)             ; Resize the apps             _Frame_Resize($hFrame_A1_Handle, $hWnd_EditPad)             _Frame_Resize($hFrame_A2_Handle, $hWnd_NotePad)         Case $hFrame_A1_Handle             ; Resize the app             _Frame_Resize($hFrame_A1_Handle, $hWnd_EditPad)         Case $hFrame_A2_Handle             ; Resize the app             _Frame_Resize($hFrame_A2_Handle, $hWnd_NotePad)     EndSwitch     Return "GUI_RUNDEFMSG" EndFunc   ;==>_WM_SIZE Func _Frame_Resize($hFrame, $hWnd)     ; Get teh current size     $aFrame_Size = WinGetPos($hFrame)     ; Resize the app     WinMove($hWnd, "", 0, 0, $aFrame_Size[2], $aFrame_Size[3])     ; Redraw the app     _WinAPI_InvalidateRect($hWnd) EndFunc

I still get some flashing - but as I explained, I think it depends on the graphics setup you use. Give it a try with your 2 apps and see how you get on. :oops:

Watch out for a change of location when Valik merges the topics. :)

M23
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#54 Valik

Valik

    Former developer.

  • Active Members
  • PipPipPipPipPipPip
  • 18,879 posts

Posted 02 December 2011 - 07:56 PM

Topics now merged. There's no way to leave any form of redirection so you may need to direct the user you were discussing with to this thread.

#55 DragonBall

DragonBall

    Seeker

  • Active Members
  • 44 posts

Posted 02 December 2011 - 09:12 PM

On my god!! I found the solution. In your GUIFrame UDF , if I cange

$hFirstFrame = GUICreate("", $iSeperator_Pos, $iHeight, 0, 0, 0x40000000, -1 ,$hParent) ;$WS_CHILD
GUISetState(@SW_SHOW, $hFirstFrame)
$hSecondFrame = GUICreate("", $iWidth - ($iSeperator_Pos + $iSeparatorSize), $iHeight, $iSeperator_Pos + $iSeparatorSize, 0, 0x40000000, -1, $hParent) ;$WS_CHILD
GUISetState(@SW_SHOW, $hSecondFrame)

to $hFirstFrame = GUICreate("", $iSeperator_Pos, $iHeight, 0, 0, BitOR(0x40000000, $WS_CLIPCHILDREN),0 ,$hParent) ;$WS_CHILD
GUISetState(@SW_SHOW, $hFirstFrame)
$hSecondFrame = GUICreate("", $iWidth - ($iSeperator_Pos + $iSeparatorSize), $iHeight, $iSeperator_Pos + $iSeparatorSize, 0, BitOR(0x40000000, $WS_CLIPCHILDREN),0, $hParent) ;$WS_CHILD
GUISetState(@SW_SHOW, $hSecondFrame)

Then no more problem !!

#56 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 21,139 posts

Posted 02 December 2011 - 10:04 PM

hodgestructure,

I am glad it works to reduce the flashing for you - it makes no difference to me at all when I run the script I posted above. :D

M23

Edit: In fact it causes a number of problems when first displaying the frames now I have tried it on a number of other scripts. :oops:

Edited by Melba23, 02 December 2011 - 10:20 PM.

StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#57 DragonBall

DragonBall

    Seeker

  • Active Members
  • 44 posts

Posted 02 December 2011 - 11:36 PM

Hi, Melba23,

no problem = when I move or resize the 2 programs windows, no dispaly disappear. But if move the separator bar, yes, still flash.
But no matter.....

And I check the script you post. It's better than the original one, but not 100%, since the WinEdt.exe may still happen some problem, but no problem for SumatraPDF. Thank you!



I still have a question, not sure if need to start a new topic. The following script use GUIRegisterMsg($WM_SIZE, "_WM_SIZE") to lock some windows position. When set it to $hWnd = $hWnd_WinEdt OR $hWnd = $hWnd_SumatraPDF OR $hWnd = $hGUI_Handle. But it will lock the $GUI Window, but I can still drag WinEdt or SumatraPDF, although it will go back to the old place because I set it to be so. But what I would like to do is to lock WinEdt and SumatraPDF place, lock their left-top position to be the left-top position of the frame they belong, and don't lock the main $hGUI. Is there a way to lock a Program Window like one can lock a GUI Windows created by AutoIt??

AutoIt         
#include #include #include "GUIFrame.au3" #include #include #include #include ;;====================================== #include #include #include ;;====================================== ; Register WM_SIZE to simulate the script requiring it GUIRegisterMsg($WM_SIZE, "_WM_SIZE") ;;Don't Move, but Resiable==================================================================== GUIRegisterMsg($WM_SYSCOMMAND, "On_WM_SYSCOMMAND") ;;==================================================================== Global $hWnd_WinEdt Global $hWnd_SumatraPDF Global $hGUI_Handle $hGUI = GUICreate("GUI_Frame Example 2", 800, 600, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX)) GUISetState() $iFrame_A = _GUIFrame_Create($hGUI) _GUIFrame_SetMin($iFrame_A, 50, 100) $hGUI_Size = WinGetClientSize($hGUI) $hGUI_Handle = WinGetHandle($hGUI) $iFrame_A_Handle = $hParent_Handle $iFrame_A_Size = WinGetClientSize($hParent_Handle) $Separator_Handle = $hSeparator_Handle $Separator_Size = WinGetClientSize($hSeparator_Handle) $iFrame_A1_Handle = _GUIFrame_GetHandle($iFrame_A, 1) $iFrame_A1_Size = WinGetClientSize($iFrame_A1_Handle) $iFrame_A2_Handle = _GUIFrame_GetHandle($iFrame_A, 2) $iFrame_A2_Size = WinGetClientSize($iFrame_A2_Handle) WinWait("WinEdt 6.0") ControlClick("WinEdt 6.0", "C:UsersimoDesktopDocumentg3g3.tex", "[CLASS:TToolBar; INSTANCE:3]", "left", 1, 432, 13) $hWnd_WinEdt = WinGetHandle("[CLASS:TMainForm]") _GUICtrlMenu_SetMenu($hWnd_WinEdt,1) WinWait("[CLASS:SUMATRA_PDF_FRAME]") $hWnd_SumatraPDF = WinGetHandle("[CLASS:SUMATRA_PDF_FRAME]") $SumatraPDFPID = WinGetProcess("[CLASS:SUMATRA_PDF_FRAME]") _GUICtrlMenu_SetMenu($hWnd_SumatraPDF,1) _WinAPI_SetParent($hWnd_WinEdt, $iFrame_A1_Handle) _WinAPI_SetWindowPos($hWnd_WinEdt,$HWND_TOP,0,0 ,$iFrame_A1_Size[0],$iFrame_A1_Size[1],$SWP_SHOWWINDOW) _WinAPI_SetParent($hWnd_SumatraPDF, $iFrame_A2_Handle) _WinAPI_SetWindowPos($hWnd_SumatraPDF,$HWND_TOP,10,0 ,$iFrame_A2_Size[0]-10,$iFrame_A2_Size[1],$SWP_SHOWWINDOW) MsgBox(0,"test", $hGUI_Handle ) MsgBox(0,"test", $iFrame_A_Handle ) MsgBox(0,"test", $Separator_Handle ) MsgBox(0,"test", $iFrame_A1_Handle ) MsgBox(0,"test", $iFrame_A2_Handle ) MsgBox(0,"test", $hWnd_WinEdt ) MsgBox(0,"test", $hWnd_SumatraPDF ) MsgBox(0,"test", $hGUI_Size[0] ) MsgBox(0,"test", $iFrame_A_Size[0] ) MsgBox(0,"test", $Separator_Size[0] ) MsgBox(0,"test", $iFrame_A1_Size[0] ) MsgBox(0,"test", $iFrame_A2_Size[0] ) _GUIFrame_ResizeSet(0) ; DO NOT Register the $WM_SIZE handler to permit resizing as the message is already registered ;_GUIFrame_ResizeReg() While 1 Switch GUIGetMsg()   Case $GUI_EVENT_CLOSE    ; The UDF does all the tidying up as you exit    Exit EndSwitch $hGUI_Size = WinGetClientSize($hGUI) $iFrame_A1_Size = WinGetClientSize($iFrame_A1_Handle) $iFrame_A2_Size = WinGetClientSize($iFrame_A2_Handle)     Sleep(10)   WinMove($iFrame_A_Handle,"", 0,0, $hGUI_Size[0],$hGUI_Size[1])         WinMove($Separator_Handle,"", $hGUI_Size[0]/2,0, 10,$hGUI_Size[1])         WinMove($iFrame_A1_Handle,"",0,0, $hGUI_Size[0]/2,$hGUI_Size[1])      WinMove($iFrame_A2_Handle,"", $hGUI_Size[0]/2, 0,$hGUI_Size[0]/2,$hGUI_Size[1])   _WinAPI_SetWindowPos($hWnd_WinEdt,$HWND_TOP,0,0 ,$iFrame_A1_Size[0],$iFrame_A1_Size[1],$SWP_SHOWWINDOW)   _WinAPI_SetWindowPos($hWnd_SumatraPDF,$HWND_TOP,10,0 ,$iFrame_A2_Size[0]-10,$iFrame_A2_Size[1],$SWP_SHOWWINDOW) WEnd ; This is the already registered WM_SIZE handler Func _WM_SIZE($hWnd, $iMsg, $wParam, $lParam)     ; Just call the GUIFrame resizing function here - do NOT use the _GUIFrame_ResizeReg function in the script     ;_GUIFrame_SIZE_Handler($hWnd, $iMsg, $wParam, $lParam)     _GUIFrame_SIZE_Handler($hWnd, $iMsg, $wParam, $lParam)     Return "GUI_RUNDEFMSG" EndFunc Func On_WM_SYSCOMMAND($hWnd, $Msg, $wParam, $lParam)      If $hWnd =  $hWnd_WinEdt OR  $hWnd = $hWnd_SumatraPDF  OR $hWnd = $hGUI_Handle Then If BitAND($wParam, 0xFFF0) = 0xF010 Then Return False   EndIf     Return $GUI_RUNDEFMSG EndFunc

Edited by hodgestructure, 03 December 2011 - 12:03 AM.


#58 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 21,139 posts

Posted 03 December 2011 - 08:44 AM

hodgestructure,

I believe that you can intercept messages from other GUIs by installing Global Hooks such as here - but it looks as if the messages you can intercept are limited. Certainly something like that is beyond my coding ability - and nothing to do with the GUIFrame UDF so if you want help on it please open a new topic. :D

However, you can monitor the position of the Child apps by looking to see if their position has changed like this:
AutoIt         
AdlibRegister("_PosCheck", 5000) ; Set this time to fit your requirements While 1     Switch GUIGetMsg()         Case $GUI_EVENT_CLOSE             Exit     EndSwitch WEnd Func _PosCheck()     _WndCheck($hFrame_A1_Handle, $hWnd_EditPad)     _WndCheck($hFrame_A2_Handle, $hWnd_NotePad) EndFunc Func _WndCheck($hFrame, $hWnd)     Local $aFramePos = WinGetPos($hFrame)     Local $aChildPos = WinGetPos($hWnd)     If $aFramePos[0] <> $aChildPos[0] Or $aFramePos[1] <> $aChildPos[1] Then         WinMove($hWnd, "", 0, 0)         _WinAPI_InvalidateRect($hWnd)     EndIf EndFunc

Not perfect but the best I can do. :oops:

M23
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#59 Mikeman27294

Mikeman27294

    Insert Member Title Here

  • Active Members
  • PipPipPipPipPipPip
  • 469 posts

Posted 19 January 2012 - 01:58 PM

Hey everyone.
I have used this UDF before, and I was looking into just playing round with frames again. Using the example scripts provided and mine, I came up with this:
#include <GuiFrame.au3> Global $GuiArray[10] $GuiArray[0] = GUICreate("Test", @DesktopWidth*0.75, @DesktopHeight*0.75) GUISetState(@SW_SHOW, $GuiArray[0]) $Frame = _GUIFrame_Create($GuiArray[0]) $FramePos = _GUIFrame_SetMin($Frame, 50, 100) While 1 Switch GUIGetMsg() Case -3 Exit EndSwitch WEnd

It runs, but it doesn't create a frame. I ran my other script too and it doesn't show a frame either, but it used to. I updated to the most recent UDF and played with the script provided for hours but couldn't get it to work. Am I doing something wrong?
Thanks.
Spoiler


#60 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 21,139 posts

Posted 19 January 2012 - 02:03 PM

Mikeman27294,

It works for me. What OS are you running? :)

M23
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users