Jump to content

Search the Community

Showing results for tags 'click gui label'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Hi Forum, I'm having trouble accomplishing the following: I'd like to click a label on the GUI just after showing the GUI itself (to eventually fire the event bind to the label) Here is simple version of the code (see the line under "Trying to click the 1st link") #include <GuiConstants.au3> #include <GuiConstantsEx.au3> #include <SendMessage.au3> #include <AutoItConstants.au3> #Region GLOBAL VARIABLES     Global $iGuiW = 400, $iGuiH = 400            ; GUI Size, Width and Height     Global $iGuiTopH = 52, $iGuiBotH = 52        ; GUI Size, Top Height, Bottom Height     Global $iLeftWidth = 250                    ; GUI Size, Left Menu Width     Global $iGap = 10                            ; GUI Size, Space between links (vertical)     Global $iRightWidth = 100     Global $hMainGUI #EndRegion GLOBAL VARIABLES #Region OPTIONS     Opt('MustDeclareVars', 1)        ; Variables must be pre-declared - removes the chance for misspelled variables causing bugs     Opt("GUIOnEventMode", 1)         ; Change to OnEvent mode #EndRegion OPTIONS _MainGui() Func _MainGui()     ; Vars     Local $hFooter, $nMsg, $aPos     Local $iLinks = 5                                                                                        ; Number of links (minus 1)     Local $sMainGuiTitle = "Main"                                                                            ; Title     Local $sHeader = " Main - " & @ScriptName & " - " & @ComputerName                                        ; Header     Local $sFooter = "2017©"                                                                                ; Footer     GLobal $aLink[$iLinks], $aPanel[$iLinks], $aIdTreeviewFile[$iLinks]                                        ; Links and Panels         $aLink[0] = $iLinks - 1         $aPanel[0] = $iLinks - 1     ; Shortcut to close to escape possible loop     HotKeySet("{F1}", "OnF1")     ; Create GUI     $hMainGUI = GUICreate($sMainGuiTitle, $iGuiW, $iGuiH, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_TABSTOP))     ;Adding Links and bind event     For $i = 1 To $aLink[0]             $aLink[$i] = _AddNewLink('Link ' & $i)             GUICtrlSetOnEvent($aLink[$i], "_ShowMessage")     Next     ;show the main GUI     GUISetState(@SW_SHOW, $hMainGUI)     ;Trying to click the 1st link     local $hwnd = GUICtrlGetHandle ($aLink[1])     _DebugPrint($hwnd & ' search for handle')     local $return = _SendMessage($hwnd, $BM_CLICK)     _DebugPrint($return & ' return from sendmessage')     While 1         Sleep(100) ; Sleep to reduce CPU usage     WEnd EndFunc ;==>_MainGui Func _ShowMessage()     MsgBox(1, '', GUICtrlRead(@GUI_CtrlId)) EndFunc Func _AddNewLink($sTxt, $iIcon = -44)     Local $hLink = GUICtrlCreateLabel($sTxt, 36, $iGuiTopH + $iGap, $iLeftWidth - 46, 17)     GUICtrlSetCursor(-1, 0)     GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)     GUICtrlCreateIcon("shell32.dll", $iIcon, 10, $iGuiTopH + $iGap, 16, 16)     GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)     $iGap += 22     Return $hLink EndFunc ;==>_AddNewLink Func _AddControlsToPanel($hPanel)     GUISwitch($hPanel) EndFunc ;==>_AddControlsToPanel ; to create escape function in case X is blocked. Func OnF1()     Exit EndFunc        ;==>OnF1 Func _DebugPrint($s_Text, $sLine = @ScriptLineNumber)     ConsoleWrite( "DebugPrint -->Line(" & StringFormat("%04d", $sLine) & "):" & @TAB & $s_Text & @CRLF) EndFunc   ;==>_DebugPrint Thanks in advance! Rick
×
×
  • Create New...