Jump to content
Sign in to follow this  
AramisResearch

Mouse-Click Awareness?

Recommended Posts

AramisResearch

My GUI form works - it's rudimentary, but it has basic error checking and such, so it'll do - but I am forced to use TAB and SHIFT-TAB to navigate between fields. How do I tell my GUI that I want it to listen to mouse clicks when a user moves the mouse to another text field and clicks on it?

Thanks,

-Chris

Share this post


Link to post
Share on other sites
Xenobiologist

Hi,

post your script. In the helpfile there are examples how to deal with something like:

While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
Coldburn

I have the same issue, the mouse doesnt seem to work trying to move the cursor around to various objects.

; - SCRIPT START
#include <GUIConstants.au3>
#include <string.au3>

;Global $sIniPath = @UserProfileDir & "\Local Settings\Authtool\"
Global $sIniPath = "" ; for debuging
Global $sIniFile = "authtool.ini"
Global $sIniPathFile = $sIniPath & $sIniFile

Global $gWidth = 335
Global $gHeight = 250

; ASSIGN VARS FROM INI IF EXIST
Global $sIafUrl = IniRead($sIniPathFile, "iaf", "url", "https://iafcustomerservicereps.sbc.com/csr/")
Global $sIafUname = IniRead($sIniPathFile, "iaf", "uname", @UserName)
Global $sIafDecry = IniRead($sIniPathFile, "iaf", "passwd", "")
$sIafPasswd = _StringEncrypt(0, $sIafDecry, @username, 2)

Global $sEhelpUrl = IniRead($sIniPathFile, "ehelpdesk", "url", "https://ehelpdesk.sbcis.sbc.com/tt/start/login.jsp")
Global $sEhelpUname = IniRead($sIniPathFile, "ehelpdesk", "uname", @UserName)
Global $sEhelpDecry = IniRead($sIniPathFile, "ehelpdesk", "passwd", "")
$sEhelpPasswd = _StringEncrypt(0, $sEhelpDecry, @username, 2)

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

; GUICreate ( "title" [, width [, height [, left [, top [, style [, exStyle [, parent]]]]]]] )
$gMain = GUICreate("AuthTool-GUI", $gWidth, $gHeight)

; IAF SECTION
; GUICtrlCreateLabel ( "text", left, top [, width [, height [, style [, exStyle]]]] )
GUICtrlCreateLabel ("-- IAF Horizon",  8, 10, $gWidth-20, 100, $SS_SUNKEN  )

GUICtrlCreateLabel ("URL :",  12, 33)
$sIafUrl = GUICtrlCreateInput($sIafUrl, 45, 30, 270)

GUICtrlCreateLabel ("User Name :",  12, 60)
$sIafUname = GUICtrlCreateInput($sIafUname, 80, 57, 95)

GUICtrlCreateLabel ("Password :",  12, 88)
$sIafPasswd = GUICtrlCreateInput($sIafPasswd, 80, 85, 95, 20, $ES_PASSWORD)

; - EHELPDESK SECTION
; GUICtrlCreateLabel ( "text", left, top [, width [, height [, style [, exStyle]]]] )
GUICtrlCreateLabel ("-- eHelpDesk Ticketing System",  8, 115, $gWidth-20, 100, $SS_SUNKEN  )

GUICtrlCreateLabel ("URL :",  12, 138)
$sEhelpUrl = GUICtrlCreateInput($sEhelpUrl, 45, 135, 270)

GUICtrlCreateLabel ("User Name :",  12, 165)
$sEhelpUname = GUICtrlCreateInput($sEhelpUname, 80, 163, 95)

GUICtrlCreateLabel ("Password :",  12, 193)
$sEhelpPasswd = GUICtrlCreateInput($sEhelpPasswd, 80, 190, 95, 20, $ES_PASSWORD)

; - BUTTONS
$btn_Submit = GuiCtrlCreateButton("Submit", 10, 225, 75, 22)
$btn_Clear  = GuiCtrlCreateButton("Clear" , 90, 225, 75, 22)
$btn_Cancel = GuiCtrlCreateButton("Close" , 170, 225, 75, 22)
$btn_Passwd = GuiCtrlCreateButton("Passwd" , 250, 225, 75, 22)

GUICtrlSetOnEvent($btn_Submit, "SubmitClicked")
GUICtrlSetOnEvent($btn_Clear, "ClearClicked")
GUICtrlSetOnEvent($btn_Passwd, "ShowPasswd")
GUICtrlSetOnEvent($btn_Cancel, "CloseClicked")
GUISetOnEvent($GUI_EVENT_CLOSE, "CloseClicked")

; - ACTIVATE GUI
GUISetState(@SW_SHOW)

While 1
  Sleep(1000)  ; Idle around
WEnd

Exit    ; EXIT SCRIPT

;
; - SubmitClicked : write ini file
;
Func SubmitClicked()
    ;MsgBox(0, "GUI Event", "You pressed OK!")
    If Not FileExists($sIniPath) Then DirCreate($sIniPath) ; check to see if ini path exists or make it

    If @error Then 
        MsgBox(48, "AuthTool-GUI : Error", "Error occured, could not write INI file. -" & @error)
        Exit  ; EXIT SCRIPT
    EndIf

    ; IniWrite automatically makes file if not exist
    IniWrite($sIniPathFile, "ehelpdesk", "url", GUICtrlRead($sEhelpUrl))
    IniWrite($sIniPathFile, "ehelpdesk", "uname", GUICtrlRead($sEhelpUname))
    
    ;_StringEncrypt ( $i_Encrypt, $s_EncryptText, $s_EncryptPassword [, $i_EncryptLevel ] )
    $sEhelpEncry = _StringEncrypt(1, GUICtrlRead($sEhelpPasswd), @username, 2)
    IniWrite($sIniPathFile, "ehelpdesk", "passwd", $sEhelpEncry)
    
    IniWrite($sIniPathFile, "iaf", "url", GUICtrlRead($sIafUrl))
    IniWrite($sIniPathFile, "iaf", "uname", GUICtrlRead($sIafUname))
    
    $sIafEncry = _StringEncrypt(1, GUICtrlRead($sIafPasswd), @username, 2)
    IniWrite($sIniPathFile, "iaf", "passwd", $sIafEncry)
        
    If @error Then 
    MsgBox(48, "AuthTool-GUI : Error", "Error occured, could not write INI file. -" & @error)
    Else
    MsgBox(64, "AuthTool-GUI : Saved", "Setup of application credentials are saved!", 30)                   
    EndIf
    
EndFunc

;
; - ClearClicked : clear form (needs work)
;
Func ClearClicked()
    Global $sIafUrl = ""
    Global $sIafUname = ""
    Global $sIafPasswd = ""

    Global $sEhelpUrl = ""
    Global $sEhelpUname = ""
    Global $sEhelpPasswd = ""

EndFunc

;
; - CloseClicked : exit script
;
Func CloseClicked()
  Exit
EndFunc

;
; - ShowPasswd : used for debugging
;
Func ShowPasswd()
    $sMsg = "Iaf : " & GUICtrlRead($sIafPasswd) & @CR
    $sMsg &= "eHelp : " & GUICtrlRead($sEhelpPasswd)
    
    MsgBox(0, "AuthTool-GUI : Passwords", $sMsg)
EndFunc

Thanks for any help!

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  

×