Naveed 0 Posted August 4, 2010 I have a multitab gui and i need a way of knowing which tab is active? I use the following for my hotkey function HotKeySet("{Enter}", "onEnter") Func onenter() If WinActive($GUI) Then Go() Else HotKeySet("{Enter}") Send("{Enter}") HotKeySet("{Enter}", "onenter") EndIf EndFunc However this activates the GO function regardless of which tab i am on? Would it be possible to know which tab is active and activate a different function depending on the tab? Any help will be appreciated Thanks Naveed Share this post Link to post Share on other sites
Melba23 3,456 Posted August 4, 2010 Naveed,You use GUICtrlRead like this: #include <GUIConstantsEx.au3> HotKeySet("{Enter}", "onEnter") $hGUI = GUICreate("Test", 500, 500) $hTab = GUICtrlCreateTab(10, 10, 480, 480) $hTab_0 = GUICtrlCreateTabItem("Tab 0") $hTab_1 = GUICtrlCreateTabItem("Tab 1") $hTab_2 = GUICtrlCreateTabItem("Tab 2") GUICtrlCreateTabItem("") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func onEnter() $iIndex = GUICtrlRead($hTab) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< MsgBox(0, "Active Tab", "Tab " & $iIndex & " is active") EndFuncM23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Share this post Link to post Share on other sites
Naveed 0 Posted August 4, 2010 Naveed, You use GUICtrlRead like this: #include <GUIConstantsEx.au3> HotKeySet("{Enter}", "onEnter") $hGUI = GUICreate("Test", 500, 500) $hTab = GUICtrlCreateTab(10, 10, 480, 480) $hTab_0 = GUICtrlCreateTabItem("Tab 0") $hTab_1 = GUICtrlCreateTabItem("Tab 1") $hTab_2 = GUICtrlCreateTabItem("Tab 2") GUICtrlCreateTabItem("") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func onEnter() $iIndex = GUICtrlRead($hTab) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< MsgBox(0, "Active Tab", "Tab " & $iIndex & " is active") EndFunc M23 Just Tested it and it works like a charm You are a genius, Thank you very much Share this post Link to post Share on other sites
Melba23 3,456 Posted August 4, 2010 Naveed,You are a geniusNo, but the developers of AutoIt are! By the way, when you reply please use the "Add Reply" button at the top and bottom of the page rather then the "Reply" button in the post itself. That way you do not get the contents of the previous post quoted in your reply and the whole thread becomes easier to read. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Share this post Link to post Share on other sites