Jump to content

Updating Controls In Custom Functions - Help


Recommended Posts

I have a GUI in on event mode and I am updating some GUIControls using custom functions.

The controls do update however all of my OnEvent commands are worthless.

The only way I can close it is with task manager or the icon in the taskbar.

I have tried declaring the variables for my controls and Global variables but it didn't help.

The real script is to damn big but here is enough of a script to reproduce what I'm doing.

Any help would be appreciated.

Thanks, Kenny

#include <GuiConstants.au3>
AutoItSetOption("GUIOnEventMode", 1) 

;Declare Global Variables that will be used used by Custom Functions
Global $Label_1
Global $Button_1

GuiCreate("CWD ITS Department - PC Quality Control Check", 863, 575,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Label_1 = GuiCtrlCreateLabel("Hardware Inventory", 100, 10, 100, 20)
$Button_1 = GUICtrlCreateButton("Refresh All Settings", 675, 30, 180, 20)

GUICtrlSetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUICtrlSetOnEvent($Button_1, "Test")

GUISetState(@SW_SHOW)
While 1
    Sleep(1000)
WEnd

Func CLOSEClicked ()
    Exit
EndFunc

Func Test ()
    GUICtrlSetData($Label_1, "test")
    GUICtrlSetData($Button_1, "test")
EndFunc

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Link to comment
Share on other sites

i think i got it

#include <GuiConstants.au3>
AutoItSetOption("GUIOnEventMode", 1)

;Declare Global Variables that will be used used by Custom Functions
Global $Label_1
Global $Button_1

GuiCreate("CWD ITS Department - PC Quality Control Check", 863, 575);,-1, -1 ,BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked"); ******* moved to here

$Label_1 = GuiCtrlCreateLabel("Hardware Inventory", 100, 10, 100, 20)
$Button_1 = GUICtrlCreateButton("Refresh All Settings", 675, 30, 180, 20)

GUICtrlSetOnEvent($Button_1, "Test")

GUISetState(@SW_SHOW)

While 1
    Sleep(1000)
WEnd

Func CLOSEClicked()
    Exit
EndFunc

Func Test ()
    GUICtrlSetData($Label_1, "test")
    GUICtrlSetData($Button_1, "test")
EndFunc

8)

NEWHeader1.png

Link to comment
Share on other sites

no good :)

I tried it on my test script, but I can't close it no matter what with or without your suggestion.

What am I doing wrong it looks fine

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Link to comment
Share on other sites

Kinda, I just moved the line you mentioned in my script which is why it still didn't work. I got it now though, thanks to your reply I found it, just compared yours to mine line by line. I hadn't realized there was a GUISetOnEvent and a GUICtrlSetOnEvent.

I've only put together 2 or 3 GUI's with this and it's been some time since I built the last one. Thanks, Kenny

Anyway after replacing several commands I got it

GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")

GUICtrlSetOnEvent($Button_18, "RefreshAll")

GUICtrlSetOnEvent($Button_1, "EnableRDP")

Thanks for the help man.

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

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