Jump to content

GuiCtrlCreateList and OnEvent handling


Tys
 Share

Recommended Posts

Hi community,

I am trying to get a reaction to a click inside the list control via OnEvent. It does not happen, why is that?

One second thing, where are the differences between GUISetOnEvent and GUICtrlSetOnEvent except that GUICtrlSetOnEvent does not get the Windows Close action?

/edit, OK, forget the second part, I did read the helpfile again, that helped;)

#include <GUIConstants.au3>
Opt ("GUIOnEventMode", 1)
;------------------------------------------Fill List---------------
GUICreate("RDP/VNC-Selector", 280, 300)
$ListClients = GUICtrlCreateList("", 10, 20, 110, 280)
For $i = 1 To 5
    $Client = "Client" & $i
    GUICtrlSetData($ListClients, $Client)
Next
;----------------------------------------Resolution chooser
GUICtrlCreateLabel("Auflösung:", 130, 4)
$radio800x600 = GUICtrlCreateRadio("800x600", 130, 20, 120, 20)
$radio1024x768 = GUICtrlCreateRadio("1024x768", 130, 36, 120, 20)
$radiofullscreen = GUICtrlCreateRadio("Vollbild", 130, 52, 120, 20)
;----------------------------------------Go Button
$buttonGo = GUICtrlCreateButton("Start", 216, 270, 60)
;---------------------------------------Set CtrlEvents
GUICtrlSetOnEvent($ListClients, "ClientsList")
GUICtrlSetOnEvent($radio800x600, "_800x600")
GUICtrlSetOnEvent($radio1024x768, "_1024x768")
GUICtrlSetOnEvent($radiofullscreen, "Fullscreen")
GUICtrlSetOnEvent($buttonGo, "GoButton")
GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
GUISetState(@SW_SHOW)
While 1
    Sleep(1000)
WEnd
Func GoButton()
    MsgBox(4096, "GoButton!", "GoButton")
EndFunc ;==>GoButton
Func ClienteList()
    MsgBox(4096, "ClientsList", "ClientsList")
EndFunc ;==>ClienteList
Func _800x600()
    MsgBox(4096, "800", "800")
EndFunc ;==>_800x600
Func _1024x768()
    MsgBox(4096, "1024", "1024")
EndFunc ;==>_1024x768
Func Fullscreen()
    MsgBox(4096, "Fullscreen", "Fullscreen")
EndFunc ;==>Fullscreen
Func SpecialEvents()
    Select
        Case @Gui_CtrlId = $GUI_EVENT_CLOSE
            MsgBox(0, "Close Pressed", "ID=" & @Gui_CtrlId & " WinHandle=" & @Gui_WinHandle)
            Exit
        Case @Gui_CtrlId = $GUI_EVENT_MINIMIZE
            MsgBox(0, "Window Minimized", "ID=" & @Gui_CtrlId & " WinHandle=" & @Gui_WinHandle)
        Case @Gui_CtrlId = $GUI_EVENT_RESTORE
            MsgBox(0, "Window Restored", "ID=" & @Gui_CtrlId & " WinHandle=" & @Gui_WinHandle)
    EndSelect
EndFunc ;==>SpecialEvents
Edited by Tys
Link to comment
Share on other sites

Hi community,

I am trying to get a reaction to a click inside the list control via OnEvent. It does not happen, why is that?

One second thing, where are the differences between GUISetOnEvent and GUICtrlSetOnEvent except that GUICtrlSetOnEvent does not get the Windows Close action?

/edit, OK, forget the second part, I did read the helpfile again, that helped;)

#include <GUIConstants.au3>
Opt ("GUIOnEventMode", 1)
;------------------------------------------Fill List---------------
GUICreate("RDP/VNC-Selector", 280, 300)
$ListClients = GUICtrlCreateList("", 10, 20, 110, 280)
For $i = 1 To 5
    $Client = "Client" & $i
    GUICtrlSetData($ListClients, $Client)
Next
;----------------------------------------Resolution chooser
GUICtrlCreateLabel("Auflösung:", 130, 4)
$radio800x600 = GUICtrlCreateRadio("800x600", 130, 20, 120, 20)
$radio1024x768 = GUICtrlCreateRadio("1024x768", 130, 36, 120, 20)
$radiofullscreen = GUICtrlCreateRadio("Vollbild", 130, 52, 120, 20)
;----------------------------------------Go Button
$buttonGo = GUICtrlCreateButton("Start", 216, 270, 60)
;---------------------------------------Set CtrlEvents
GUICtrlSetOnEvent($ListClients, "ClientsList")
GUICtrlSetOnEvent($radio800x600, "_800x600")
GUICtrlSetOnEvent($radio1024x768, "_1024x768")
GUICtrlSetOnEvent($radiofullscreen, "Fullscreen")
GUICtrlSetOnEvent($buttonGo, "GoButton")
GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
GUISetState(@SW_SHOW)
While 1
    Sleep(1000)
WEnd
Func GoButton()
    MsgBox(4096, "GoButton!", "GoButton")
EndFunc;==>GoButton
Func ClienteList()
    MsgBox(4096, "ClientsList", "ClientsList")
EndFunc;==>ClienteList
Func _800x600()
    MsgBox(4096, "800", "800")
EndFunc;==>_800x600
Func _1024x768()
    MsgBox(4096, "1024", "1024")
EndFunc;==>_1024x768
Func Fullscreen()
    MsgBox(4096, "Fullscreen", "Fullscreen")
EndFunc;==>Fullscreen
Func SpecialEvents()
    Select
        Case @Gui_CtrlId = $GUI_EVENT_CLOSE
            MsgBox(0, "Close Pressed", "ID=" & @Gui_CtrlId & " WinHandle=" & @Gui_WinHandle)
            Exit
        Case @Gui_CtrlId = $GUI_EVENT_MINIMIZE
            MsgBox(0, "Window Minimized", "ID=" & @Gui_CtrlId & " WinHandle=" & @Gui_WinHandle)
        Case @Gui_CtrlId = $GUI_EVENT_RESTORE
            MsgBox(0, "Window Restored", "ID=" & @Gui_CtrlId & " WinHandle=" & @Gui_WinHandle)
    EndSelect
EndFunc;==>SpecialEvents

<{POST_SNAPBACK}>

Func ClienteList() -> Func ClientsList()
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...