Jump to content

Need help detecting what ControlID that the user click..


Burgaud
 Share

Recommended Posts

I have:

GUICtrlCreateEdit
GUICtrlCreateInput
GUICtrlCreateTab
GUICtrlCreateTabItem
GUICtrlCreateListView
None are overlapped... 
 
When I click on any of the above Controls, I want Autoit to call a function and perform tasks based on where the user clicked.
Currently, I am using
GUIRegisterMsg($WM_COMMAND,     "_LostFocus")
func _LostFocus($hWnd, $Msg, $wParam, $lParam)
    local $nNotifyCode = BitShift($wParam, 16)
    local $nID = BitAND($wParam, 0x0000FFFF)
    .....if $nNotifyCode is 256, then $nID is the ControlID that has focus (or click)
endfunc
 
But it is not working properly when I clicked on tabs: $nID is not updated, and $nNotifyCode is 512...
I could use $nNotifyCode = 512 to mean user clicked on tabs but I still need to know which tab
 
help
 
 
 
Link to comment
Share on other sites

In helpfile for GUICtrlCreateTabItem() is example for catching change of "active Tab":

#include <GUIConstantsEx.au3>

Example()

Func Example()
    GUICreate("My GUI Tab", 250, 150); will create a dialog box that when displayed is centered

    GUISetBkColor(0x00E0FFFF)
    GUISetFont(9, 300)

    Local $idTab = GUICtrlCreateTab(10, 10, 200, 100)

    GUICtrlCreateTabItem("tab0")
    GUICtrlCreateLabel("label0", 30, 80, 50, 20)
    GUICtrlCreateButton("OK0", 20, 50, 50, 20)
    GUICtrlCreateInput("default", 80, 50, 70, 20)

    GUICtrlCreateTabItem("tab----1")
    GUICtrlCreateLabel("label1", 30, 80, 50, 20)
    GUICtrlCreateCombo("", 20, 50, 60, 120)
    GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo|guinness", "Jon"); default Jon
    GUICtrlCreateButton("OK1", 80, 50, 50, 20)

    GUICtrlCreateTabItem("tab2")
    GUICtrlSetState(-1, $GUI_SHOW); will be display first
    GUICtrlCreateLabel("label2", 30, 80, 50, 20)
    GUICtrlCreateButton("OK2", 140, 50, 50)

    GUICtrlCreateTabItem(""); end tabitem definition

    GUICtrlCreateLabel("Click on tab and see the title", 20, 130, 250, 20)

    GUISetState(@SW_SHOW)

    Local $idMsg
    ; Loop until the user exits.
    While 1
        $idMsg = GUIGetMsg()

        If $idMsg = $GUI_EVENT_CLOSE Then ExitLoop
        If $idMsg = $idTab Then
            ; display the clicked tab
            WinSetTitle("My GUI Tab", "", "My GUI Tab" & GUICtrlRead($idTab))
        EndIf
    WEnd
EndFunc   ;==>Example

 

Link to comment
Share on other sites

  • Developers
10 hours ago, Burgaud said:

GUIOnEventMode 1 was more trouble. 

Sounds like a "driver issue". ;) 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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