Jump to content

GUICtrlSetOnEvent does not trigger function upon event


Recommended Posts

I'm using AutoIT v.3.2.0.1. I created a GUI using Koda. All of the functions that are created by GUICtrlSetOnEvent() work fine, with the exception of one. This function is never executed when the event occcurs. I checked the return status of that particular GUICtrlSetOnEvent() call and it returns sccessfully. Here's the offending part of the code. Perhaps it's something obvious that I'm overlooking:

$ViewImageButton = GUICtrlCreateButton("View Processed Image", 178, 350, 171, 25, 0)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetOnEvent(-1, "ViewButtonclick")

.
.
.

Func ViewButtonclick()
    
    $ImageArray = GetImageList($ItemList2)

EndFunc

ViewButtonclick() never gets called when the "ViewButtonclick" event occurs. However, all other event-triggered functions work fine.

Thanks in advance for your help!

Link to comment
Share on other sites

Based off your snippet, this fires the event for me.

Opt("GUIOnEventMode",1)
GUICreate("none",300,300)
$ViewImageButton = GUICtrlCreateButton("View Processed Image", 10,10,200,25)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetOnEvent(-1, "ViewButtonclick")
GUISetState(@SW_SHOW)
While 1
    Sleep(1000)
WEnd

Func ViewButtonclick()
    MsgBox(0,"func","fired")
EndFunc

Sul

Link to comment
Share on other sites

Works here too, for me

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

GUICreate("MY GUI")
$ViewImageButton = GUICtrlCreateButton("View Processed Image", 178, 350, 171, 25, 0)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetOnEvent(-1, "ViewButtonclick")
GUISetState()

While 1
    Sleep(10)
WEnd

Func ViewButtonclick()
   MsgBox(0x0,"test", "it worked")
   ; $ImageArray = GetImageList($ItemList2)

EndFunc

8)

NEWHeader1.png

Link to comment
Share on other sites

Well, I just moved those GUI lines of code higher up in that file, and the darned thing started to work. The lines of code before that GUI snippet were related to a label. Here it is just in case anyone has any ideas:

$Label5 = GUICtrlCreateLabel("Visualization Processing Tool", 328, 24, 238, 24)
GUICtrlSetFont(-1, 12, 800, 4, "MS Sans Serif")
$Label6 = GUICtrlCreateLabel("Select All Images to be Combined Into Output Image", 110, 88, 300, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetOnEvent(-1, "ALabel6Click")

Thanks again for your help :lmao:

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