Sign in to follow this  
Followers 0
sandyd

GuiSetOnEvent

3 posts in this topic

Hi All,

I've probably done something stupid here, but my eyes just can't seem to find the mistake.

Can someone have a quick glance at this code and let me know why the 'LoadBtnonclick' event is not firing?

Thanks

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode

$MainWnd=GUICreate("SPAM Log Viewer",1000,600,-1,-1)
    GUISetOnEvent($GUI_EVENT_CLOSE, "ExitScript")
$LogMemo=GUICtrlCreateEdit("Log file is loaded here",5,5,990,500)
$LoadBtn=GUICtrlCreateButton("Load Log File",895,510,100)   
    GUISetOnEvent($LoadBtn,"LoadBtnonclick")
$ViewModeLabel=GUICtrlCreateLabel("View Mode : ",5,513)
$ViewModeCombo=GUICtrlCreateCombo("",68,510,150)
    GUICtrlSetData($ViewModeCombo,"All|Allowed|Blocked|Deleted|Marked","All")
    
GUISetState(@SW_SHOW)
While 1
    Sleep(10)
WEnd

Func ExitScript()
    Exit
EndFunc

Func LoadBtnonclick()
    MsgBox(0,'Debug','Got here')
; open file dialog
    $LogFileName=FileOpenDialog("Select Log File","\\bearper4\c$\Program Files\Hexamail Guard\logs", "*.log",1,"SPAM Blocker.log")
; load file into memo
EndFunc

----[ SandyD ]---

Share this post


Link to post
Share on other sites



Hi All,

I've probably done something stupid here, but my eyes just can't seem to find the mistake.

Can someone have a quick glance at this code and let me know why the 'LoadBtnonclick' event is not firing?

Thanks

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1); Change to OnEvent mode

$MainWnd=GUICreate("SPAM Log Viewer",1000,600,-1,-1)
    GUISetOnEvent($GUI_EVENT_CLOSE, "ExitScript")
$LogMemo=GUICtrlCreateEdit("Log file is loaded here",5,5,990,500)
$LoadBtn=GUICtrlCreateButton("Load Log File",895,510,100)    
    GUISetOnEvent($LoadBtn,"LoadBtnonclick")
$ViewModeLabel=GUICtrlCreateLabel("View Mode : ",5,513)
$ViewModeCombo=GUICtrlCreateCombo("",68,510,150)
    GUICtrlSetData($ViewModeCombo,"All|Allowed|Blocked|Deleted|Marked","All")
    
GUISetState(@SW_SHOW)
While 1
    Sleep(10)
WEnd

Func ExitScript()
    Exit
EndFunc

Func LoadBtnonclick()
    MsgBox(0,'Debug','Got here')
; open file dialog
    $LogFileName=FileOpenDialog("Select Log File","\\bearper4\c$\Program Files\Hexamail Guard\logs", "*.log",1,"SPAM Blocker.log")
; load file into memo
EndFunc

<{POST_SNAPBACK}>

GUISetOnEvent($LoadBtn,"LoadBtnonclick")

$ ------------------>

GUICtrlSetOnEvent($LoadBtn,"LoadBtnonclick")

$

Share this post


Link to post
Share on other sites

Cheers JPM, knew it was something stupid.


----[ SandyD ]---

Share this post


Link to post
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
Sign in to follow this  
Followers 0