Jump to content

Recommended Posts

Posted

Hi all,

I'm having problems on an app I'm working on, so I've pared out the irrelevant code to produce the following:

#Include <Constants.au3>
#include <GUIConstants.au3>

#include <Color.au3>
#include <Array.au3>
#include <File.au3>
#Include <Misc.au3>

AutoItSetOption("GuiOnEventMode",1)                 ; Go to on-event mode

$gui = GUICreate("Stay On Focus!", 600,500)
$btnDelete0 = guictrlcreatepic("delete.jpg", 530,  30, 16, 16, bitor($SS_NOTIFY, $GUI_SS_DEFAULT_PIC))
GUISetOnEvent($btnDelete0, "deleteTask0")
GUISetState(@SW_SHOW)

While 1
    Sleep(10)
WEnd


func deleteTask0()
    msgbox(0, "deleting 0", "")
;deleteTask(0)
EndFunc

Can anyone see why a click on the icon does not result in the msgbox being displayed? (Icon attached for handy reference!)

Regards,

Andy

Posted (edited)

Andrew Peacock you make a mistake it's not "GUISetOnEvent" you have to use but "GUICtrlSetOnEvent"

Good continuation

Aza

#Include <Constants.au3>
#include <GUIConstants.au3>

#include <Color.au3>
#include <Array.au3>
#include <File.au3>
#Include <Misc.au3>

AutoItSetOption("GuiOnEventMode",1)                ; Go to on-event mode

$gui = GUICreate("Stay On Focus!", 600,500)
$btnDelete0 = guictrlcreatepic("delete.jpg", 530,  30, 16, 16, bitor($SS_NOTIFY, $GUI_SS_DEFAULT_PIC))
GUICtrlSetOnEvent($btnDelete0,"deleteTask0")
;GUISetOnEvent($btnDelete0, "deleteTask0")
GUISetState(@SW_SHOW)

While 1
    Sleep(10)
WEnd


func deleteTask0()
    msgbox(0, "deleting 0", "")
;deleteTask(0)
EndFunc
Edited by Azazel
Posted

Andrew Peacock you make a mistake it's not "GUISetOnEvent" you have to use but "GUICtrlSetOnEvent"

Good continuation

Aza

Doh! What a numpty I am!

Thanks very much :-)

(NB: numpty = Scottish word for "idiot")

Andy

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...