Wooltown Posted August 20, 2008 Share Posted August 20, 2008 How can I detect the difference between when I press Ctrl+Tab and Ctrl+Tab+Tab. I wish to have different events depending on the combination of keys I press. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 20, 2008 Moderators Share Posted August 20, 2008 How can I detect the difference between when I press Ctrl+Tab and Ctrl+Tab+Tab.I wish to have different events depending on the combination of keys I press.Can you elaborate a bit more? Is this for an AutoIt GUI? HotKey? ... Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Wooltown Posted August 20, 2008 Author Share Posted August 20, 2008 Wow that was a fast answer !! Yes, I have a GUI with several Tabs. If I press Ctrl+Tab, it will change from current to previous Tab. If I hold down Ctrl and Press Tab numerous of times, it will circle through all Tabs. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 20, 2008 Moderators Share Posted August 20, 2008 Wow that was a fast answer !!Yes, I have a GUI with several Tabs.If I press Ctrl+Tab, it will change from current to previous Tab.If I hold down Ctrl and Press Tab numerous of times, it will circle through all Tabs.That's how I roll Have you tried GUISetAccelerators() yet? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Wooltown Posted August 20, 2008 Author Share Posted August 20, 2008 Yes, I am using it in my code. But I don't see how it can detect the difference ? I will make a go and see if I can get it to work. Link to comment Share on other sites More sharing options...
Wooltown Posted August 21, 2008 Author Share Posted August 21, 2008 Short excerpt from my code Local $l_AccelKeys[2][2] = [["^{TAB}", $l_ChangeTab],["^{TAB}{TAB}", $l_ChangeTab2]] GUISetAccelerators($l_AccelKeys) If I put ["^{TAB}", $l_ChangeTab] first it will always use $l_ChangeTab If I put ["^{TAB}{TAB}", $l_ChangeTab2] first it will always use $l_ChangeTab2 SmOke_N - Do you have any suggestions how I should do to make it work? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 21, 2008 Moderators Share Posted August 21, 2008 Short excerpt from my code Local $l_AccelKeys[2][2] = [["^{TAB}", $l_ChangeTab],["^{TAB}{TAB}", $l_ChangeTab2]] GUISetAccelerators($l_AccelKeys) If I put ["^{TAB}", $l_ChangeTab] first it will always use $l_ChangeTab If I put ["^{TAB}{TAB}", $l_ChangeTab2] first it will always use $l_ChangeTab2 SmOke_N - Do you have any suggestions how I should do to make it work?Wow... I can't seem to get it to work either. The only other suggestion is maybe trapping the keys with something like HotKeySet() + a WM_COMMAND registered message. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Wooltown Posted August 21, 2008 Author Share Posted August 21, 2008 One idea I had was to check if Ctrl was continously pressed, checked what _IsPressed does. Googled about the DLL that is called, tested what "GetAsyncKeyState" returned, but no success. Is there a possibility to check if a key has been continously pressed ? Link to comment Share on other sites More sharing options...
ResNullius Posted August 21, 2008 Share Posted August 21, 2008 (edited) One idea I had was to check if Ctrl was continously pressed, checked what _IsPressed does. Googled about the DLL that is called, tested what "GetAsyncKeyState" returned, but no success. Is there a possibility to check if a key has been continously pressed ?What about something like this? #include <GuiConstantsEx.au3> #include <misc.au3> #include <GuiTab.au3> $gui = GUICreate("test") $Tabs = GUICtrlCreateTab(5, 5, 200) $Tab1 = GUICtrlCreateTabItem("TAB`1") $Tab2 = GUICtrlCreateTabItem("TAB`2") $Tab3 = GUICtrlCreateTabItem("TAB`3") GUICtrlCreateTabItem("") $accTabChange = GUICtrlCreateDummy() Local $l_AccelKeys[1][2] = [["^{TAB}", $accTabChange]] GUISetAccelerators($l_AccelKeys) $iTabCount = _GUICtrlTab_GetItemCount($Tabs) - 1 GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $accTabChange While _IsPressed("09"); TAB key is down $iCurrentTab = _GUICtrlTab_GetCurSel($Tabs) If $iCurrentTab <> $iTabCount Then _GUICtrlTab_SetCurFocus($Tabs, $iCurrentTab + 1) Else _GUICtrlTab_SetCurFocus($Tabs, 0) EndIf Sleep(200);a little pause so the cycling is slowed down WEnd EndSwitch WEnd If you hold down CTRL & TAB it will continuously cycle through the tabs, if you hold down CTRL & press TAB once, it will move to next tab and stop. Edited August 21, 2008 by ResNullius Link to comment Share on other sites More sharing options...
Wooltown Posted August 21, 2008 Author Share Posted August 21, 2008 (edited) OK, but if I press Ctrl+Tab once, I want to go back to the last used tab. Edited August 21, 2008 by Wooltown Link to comment Share on other sites More sharing options...
ResNullius Posted August 22, 2008 Share Posted August 22, 2008 OK, but if I press Ctrl+Tab once, I want to go back to the last used tab.Is this closer? expandcollapse popup#include <GuiConstantsEx.au3> #include <misc.au3> #include <GuiTab.au3> $gui = GUICreate("test") $Tabs = GUICtrlCreateTab(5, 5, 200) $Tab1 = GUICtrlCreateTabItem("TAB`1") $Tab2 = GUICtrlCreateTabItem("TAB`2") $Tab3 = GUICtrlCreateTabItem("TAB`3") GUICtrlCreateTabItem("") $accTabChange = GUICtrlCreateDummy() Local $l_AccelKeys[1][2] = [["^{TAB}", $accTabChange]] GUISetAccelerators($l_AccelKeys) GUISetState() $iTabCount = _GUICtrlTab_GetItemCount($Tabs) - 1 $iLastUsedTab = _GUICtrlTab_GetCurSel($Tabs) While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $accTabChange $iTabPresses = 0 $iCurrentTab = _GUICtrlTab_GetCurSel($Tabs) While _IsPressed("11"); CTRL key is held down If _IsPressed("09") Then; TAB key is pressed While _IsPressed("09"); TAB key is held down WEnd $iTabPresses += 1 ConsoleWrite("TAB Presses: " & $iTabPresses & @CRLF & @CRLF) EndIf WEnd Switch $iTabPresses Case 1 _GUICtrlTab_SetCurFocus($Tabs, $iLastUsedTab) Case 2 $iLastUsedTab = $iCurrentTab If $iCurrentTab <> $iTabCount Then _GUICtrlTab_SetCurFocus($Tabs, $iCurrentTab + 1) Else _GUICtrlTab_SetCurFocus($Tabs, 0) EndIf EndSwitch $iCurrentTab = _GUICtrlTab_GetCurSel($Tabs) EndSwitch WEnd Link to comment Share on other sites More sharing options...
Wooltown Posted August 22, 2008 Author Share Posted August 22, 2008 Unfortunately not, look in SciTe how it works when you have several files open, Ctrl+Tab, back and forth of the two latest files, Hold Down Ctrl and press Tab some times and you will change between all files. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now