Mbee Posted June 20, 2016 Share Posted June 20, 2016 (edited) I first want to thank all the many knowledgeable and generous posters here who have so graciously lent their time and efforts to helping me recently! These inlude (but are not limited to!): @Melba23, @UEZ, @mikell, @AutoBert, @trancexx, @Chimp, and others. Thanks!! Okay, now for a new issue: I have an older GUI app that used plain old non-colored buttons, which allowed the user to tab through the various controls in order. Recently, I updated it to simulate colored buttons (which are strictly verbotten) by first creating various jpegs which look like colored buttons, then using the marvellous BinaryToAu3Kompressor.exe to generate base64 data representing these jpegs, which are then loaded into memory instead of being loaded via file I/O. But, of course and alas, the user can no longer tab through these simulated buttons as they could through real buttons. So I found these new GUI thingies called tabs, and read the very helpful tutorial on them at: https://www.autoitscript.com/wiki/Tabs. Unfortunately, after much trial and eternal failure, I just can't get the simu-buttons to allow tabbing as usual. Not only that, but assuming I could figure out how to do that, how can I possibly insert them in the right order to match what would happen with real buttons (since there are still plenty of real buttons and text controls still left)? Maybe I'm asking far too much for a non-AutoIt expert... Anyway, well before I can worry about tab order, I still have to get the simu-buttons to be tabbable at all, and I'm lost. Here are my code snipetts (by the way, I'm not at all sure which Styles and Extended Styles and the like to use). Note that I'd prefer calling the _GUICtrlCreateTabItem() funcs with just a space (I realize I can't call them with a null string until the tab list is to be closed), but I added "btnx" here for clarity. Also, _My_SetCtrlImage() sets the simu-button to the binary image passed it (and BTW the _My... stuff isn't ego, it's to help me recall which functions are coded by myself versus coded by others): ; ; ; Set up to allow tabbing to image buttons as if they were real buttons... ; Global $G_TabArea = GUICtrlCreatetab( 26,214,340,30, BitOr($TCS_FIXEDWIDTH, $TCS_BUTTONS, $GUI_ENABLE) ,$WS_EX_TRANSPARENT) ;~ ; Global $G_RecTabCtrlID = GUICtrlCreateTabItem("btn1") GUICtrlSetState( $G_RecTabCtrlID, $GUI_SHOW + $GUI_ENABLE ) _My_SetCtrlImage( $G_RecButtonCtl, $G_EnaRecBtnImage ) _GUICtrlTab_SetCurFocus( $G_TabArea, 0 ) ; Set tab focus on Record button ; Global $G_StopTabCtrlID = GUICtrlCreateTabItem("btn2") GUICtrlSetState( $G_StopTabCtrlID, $GUI_HIDE ) _My_SetCtrlImage( $G_StopButtonCtl, $G_DisStopBtnImage ) ; Global $G_ResetTabCtrlID = GUICtrlCreateTabItem("btn3") GUICtrlSetState( $G_StopTabCtrlID, $GUI_HIDE ) _My_SetCtrlImage( $G_ResetButtonCtl, $G_DisResetBtnImage ) ; GUICtrlCreateTabItem("") ; Close Tab Area ; GUICtrlSetState( $G_RecButtonCtl, $GUI_ENABLE ) GUICtrlSetState( $G_StopButtonCtl, $GUI_DISABLE ) GUICtrlSetState ($G_ResetButtonCtl, $GUI_DISABLE ) When I run the app, there are at least two failures obvious: (1) The simu-buttons never get tabbed to (the keyboard tab button skips right past 'em, and (2): A totally unwanted thick dark line is drawn between the buttons on the GUI! What am I doing wrong and deserve scolding as a noob for? Thanks! Edited June 20, 2016 by Mbee typo Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 20, 2016 Moderators Share Posted June 20, 2016 Mbee, I am very unclear as to what you want to do here. You can use the {TAB} key to move between controls in a specific order because there is a $WS_TABSTOP style which tells Windows to allow this to happen - I do not believe you can apply this style to tabs. But you could do something like this: #include <GUIConstantsEx.au3> #include <GuiTab.au3> #include <MsgBoxConstants.au3> $hGUI = GUICreate("Test", 500, 500) Global $G_TabArea = GUICtrlCreateTab(26, 214, 340, 30) $G_RecTabCtrlID = GUICtrlCreateTabItem("btn1") $G_StopTabCtrlID = GUICtrlCreateTabItem("btn2") $G_ResetTabCtrlID = GUICtrlCreateTabItem("btn3") GUICtrlCreateTabItem("") $cTabDummy = GUICtrlCreateDummy() GUISetState() Global $aAccelKeys[1][2] = [["{TAB}", $cTabDummy]] GUISetAccelerators($aAccelKeys) Global $iTabIndex = 0 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cTabDummy $iTabIndex = Mod($iTabIndex + 1, 3) _GUICtrlTab_ClickTab($G_TabArea, $iTabIndex) Case $G_TabArea $iSelIndex = GUICtrlRead($G_TabArea) + 1 MsgBox($MB_SYSTEMMODAL, "Selected", "Tab: " & $iSelIndex) EndSwitch WEnd Now the {TAB} key will move between the tabs and select them - but as you are not displaying anything on the different tabs not a lot happens. Mbee 1 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 Link to comment Share on other sites More sharing options...
Mbee Posted June 20, 2016 Author Share Posted June 20, 2016 Thanks for your suggestion, Melba! I'm too tired at the moment to read and process this, but when I get a chance later tonight, if I still have questions, I'll get back to you. Goodnight! 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