Jump to content

Recommended Posts

Posted (edited)

Hi, I need some help in the GUI.

1. how can I make the test() function to be effective if I have input something and press Enter in the $Input

2. how can I make main GUI can't be clicked if I press $Button, I have set the pop-up window always on the top, but it does not work.

Thanks

#include <GUIConstantsEx.au3>

$Form = GUICreate("Form", 170, 70, 500, 270)
$Input = GUICtrlCreateInput("", 8, 8, 153, 21)
$Button = GUICtrlCreateButton("Button", 48, 40, 75, 25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button
            MsgBox(262144, "Top-most", "Test")
    EndSwitch
WEnd

Func test()
    MsgBox(64, "TEST", "ABC")
EndFunc
Edited by ASut
Posted

I'm not an expert in creating GUIs but you can try this:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form = GUICreate("Form", 170, 70, 500, 270)
$Input = GUICtrlCreateInput("", 8, 8, 153, 21)
$Button = GUICtrlCreateButton("Button", 48, 40, 75, 25)
GUISetState(@SW_SHOW)

$Dummy = GUICtrlCreateDummy()
GUIRegisterMsg(0x0111, "Check_Input") ; $WM_COMMAND = 0x0111

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            GUIRegisterMsg(0x0111, "")
            Exit
        Case $Button, $Dummy
;~             MsgBox(262144, "Top-most", "Test")
            Test()
    EndSwitch
WEnd

Func test()
   Local $hGUI = GUICreate("", 170, 70, 0, 0, $WS_POPUP, BitOR($WS_EX_MDICHILD, $WS_EX_TOPMOST), $Form)
   Local $label = GUICtrlCreateLabel("Hello World", 30, 20, 170, 70)
   GUICtrlSetFont (-1, 16)
   GUISetState(@SW_SHOW, $hGUI)
   While GUIGetMsg() <> $GUI_EVENT_CLOSE
   WEnd
   GUIDelete($hGUI)
EndFunc

Func Check_Input($hWnd, $Msg, $wParam, $lParam)
    #forceref $hWnd, $Msg, $wParam, $lParam
    If Not BitAND($wParam, 0xFFFF0000) Then GUICtrlSendToDummy($Dummy)
    Return "GUI_RUNDEFMSG"
EndFunc

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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
×
×
  • Create New...