Sign in to follow this  
Followers 0
Uten

Anygui How Do You Handel Resize Events?

2 posts in this topic

How can I make this "embeded" panel behave when notepad is resized?

Now the editor window takes over. and my embeded controls are sort of lost.

#include <ANYGUIv2.6.au3>
#include <guiconstants.au3>
; ------------------------------------------------------------------------------
AutoItSetOption("WinTitleMatchMode", 4)
AutoItSetOption("MustDeclareVars",1)
; ------------------------------------------------------------------------------
Global Const $WM_DRAWITEM = 0x002B
Global Const  $WM_NOTIFY = 0x004E

Global Const $BS_OWNERDRAW          = 0x0000000B
Global Const $BS_NOTIFY             = 0x00004000
; ------------------------------------------------------------------------------
Main()
; ------------------------------------------------------------------------------
Func Main()

    Local $pid, $winTitle, $hWndTarget, $Child
    Local $Button1, $Button2
; Get notepad started
    $pid = Run("notepad.exe","",@SW_SHOW)
    Sleep(1000)
    $winTitle = "Untitled - "

    if not WInMove($winTitle,"", 0, 0, 400, 400) then 
        msgbox(16, "ERROR", "Could not move window", 5)
        WinClose($winTitle)
        Exit
    Endif

    $hWndTarget = _GuiTarget ($winTitle, 1); mode 1 set so all '_Targetadd(s) go to this window
    ControlMove($hWndTarget, "", 15, 0, 0, 300, 400);resize Edit1 control so everything fits
    $Child = _TargetaddChild ("Test", 301, 0, 98, 400);
    GUICtrlCreateGroup ("Group 1", 0, 0, 80, 260)
    $Button1 = GUICtrlCreateButton("Open", 8, 20, 60, 33, BitOR($BS_NOTIFY, $BS_OWNERDRAW) )
    $Button2 = GUICtrlCreateButton("Save", 8, 60, 60, 33)
        GUICtrlCreateGroup ("",-99,-99,1,1) ;close group

    GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events")
    GUIRegisterMsg($WM_DRAWITEM, "MY_WM_DRAWITEM")
    GUISetState(@SW_SHOW);
; MSG LOOP -----------------------------------------------------
    dim $msg
    while 1
        $msg = GUIGetMsg()
        switch $msg
            case $Button1
                ControlSend($hWndTarget,"",15, "^o")
            case $Button2
                ControlSend($hWndTarget,"",15, "^s")
            case $GUI_EVENT_CLOSE
                Exit
            case else 
                if $msg <> 0 then ConsoleWrite("$msg:=" & $msg & @LF)
                If Not WinExists($hWndTarget) Then Exit
                sleep(250);Give the system a break..:)
        endswitch 
    wend 
    Exit
EndFunc; ==> Main()
Func WM_Notify_Events($hWnd, $Msg, $wParam, $lParam)
    ConsoleWrite("WM_Notify_Events" & @LF)
    Return $GUI_RUNDEFMSG; Proceed the default Autoit3 internal message commands
EndFunc;==>WM_NOTIFY_EVENTS() 
Func MY_WM_DRAWITEM($hWnd, $Msg, $wParam, $lParam)
    ConsoleWrite("MY_WM_DRAWITEM" & @LF)
    Return $GUI_RUNDEFMSG; Proceed the default Autoit3 internal message commands
EndFunc;==>WM_DRAWITEM

Any hints or ideas appreciated.

test_notepad.au3

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

EDIT:

Deleted .. not useful

Edited by Lapo

Share this post


Link to post
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
Sign in to follow this  
Followers 0