Jump to content

GUIFrame UDF - Melba23 version - 19 May 14


Melba23
 Share

Recommended Posts

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

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • 4 months later...

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.

#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
Link to comment
Share on other sites

  • Moderators

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:

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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

#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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • Moderators

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:

#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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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

#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
Link to comment
Share on other sites

  • Moderators

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:

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • 1 month later...

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.

Link to comment
Share on other sites

  • Moderators

Mikeman27294,

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

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...