Jump to content
Sign in to follow this  

ALT and shortcut key to select tab

Recommended Posts



As you will know, if you put a button on a form and put a & in its caption, then you can click the button by pressing ALT and whichever character had the & before it in the button's caption.

I would like to do the same for tabs in a tab control. Is it possible?

Here is a simple GUI with a three-tabbed tab control, but underlining a character in the caption for each tab doesn't click that tab like it does for buttons as described above.

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)
$Form1 = GUICreate("Test", 329, 189, 193, 123)
GUISetOnEvent($GUI_EVENT_CLOSE, "AForm1Close")
$Tab1 = GUICtrlCreateTab(12, 10, 303, 165)
$TabSheet1 = GUICtrlCreateTabItem("&One")
$TabSheet2 = GUICtrlCreateTabItem("&Two")
$TabSheet3 = GUICtrlCreateTabItem("T&hree")

While 1
Func AForm1Close()

Please can you help.



Share this post

Link to post
Share on other sites

Have you thought about using hotkeys?

Edited by paullab

Wallpaper Rotatorwith overlay, Loop through a folder of wallpaper & another of overlay, then create a combined image and set it as the wallpaperE-Mail passthru, Send any file, even executables via e-mail as plain text. The recipient can then later re-construct them.Slideshow widget, A slideshow widget similar to the Vista onePredictive typing using the Numpad, Predictive typing using the numpad of a keyboar similar to that on a mobile phone (the key is the .t16 file).PSTools Front End, For Remote Admin. Just makes life a lot easier (Demonstrates executing external programs and passing parameters, tabbed form Handling STDIN/STDERR)FTP Helper application Up and Download files from an FTP server demonstrates this and Tooltray TipsShow a Map of your Post-codes/Zip Codes, Uses the Clipboard, Hotkeys, the system tray (incl. menus)Disc/CD/DVD Catalogue, Ideal for all those Covermount Discs (Demonstrates Array handling, executing DOS programs, handling STDIN/STDOUT recursive directory reads, file searching.)YAST , Yet another Stopwatch/Timer (Uses a hotkey, Copies to clipboard, handles multiple events and stays on top)Keyboard Status Indicator , Indicates status of NumLock, Caps Lock and Scroll Lock Keys, demonstrates API calling & System tray Icon Toggling

Share this post

Link to post
Share on other sites

Okay so this is kind of an old thread but I found it while searching for something else and just had to answer it.

I've done this several times in scripts I've written and always thought it worked well. Give a script like this a try:

#include <GUIConstants.au3>

$gui = GUICreate('', 200, 200)
$bt_Tab1 = GUICtrlCreateButton('&h', -99, -99, 0, 0)
$bt_Tab2 = GUICtrlCreateButton('&w', -99, -99, 0, 0)

GUICtrlCreateLabel('Tab example:', 0, 0, 100, 15)
GUICtrlCreateTab(10, 20, 180, 150)
$tbi_Tab1 = GUICtrlCreateTabItem('&Hello')
     GUICtrlCreateLabel('Label', 50, 80, 50, 15)
$tbi_Tab2 = GUICtrlCreateTabItem('&World')
     GUICtrlCreateButton('Button', 50, 90, 50, 20)

GUICtrlCreateLabel('Tadaa!', 50, 185, 50, 15)


While 1
     $gm = GUIGetMsg()
     Switch $gm
          Case $bt_Tab1
               GUICtrlSetState($tbi_Tab1, $GUI_SHOW)
          Case $bt_Tab2
               GUICtrlSetState($tbi_Tab2, $GUI_SHOW)
          Case $GUI_EVENT_CLOSE

Share this post

Link to post
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
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.