Modify ↓
      
        #211 closed Bug (No Bug)
GUICtrlToolbar UDF: Button text accelerator prefix underscore disappears
| Reported by: | rover | Owned by: | Gary | 
|---|---|---|---|
| Milestone: | Component: | Standard UDFs | |
| Version: | 3.2.11.7 | Severity: | |
| Keywords: | _GUICtrlToolBar_Create(), beta | Cc: | 
Description
Toolbar button text accelerator prefix underscore disappears
when a Button/Radio/Checkbox/Group control is added to GUI
Tested on 2 machines running XP SP2+ EN X86
AutoIt: Prod. v3.2.10.0, Beta v3.2.11.7
The problem is intermittent when run from SciTE,
but consistent when compiled.
#include <GuiToolBar.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>
#include <WindowsConstants.au3>
Opt("MustDeclareVars", 1)
_Main()
Func _Main()
	Local $hgui, $hToolbar, $Label
	Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp
	Local $aStrings[4]
	Local $bStyle = BitOR($BTNS_SHOWTEXT, $BTNS_AUTOSIZE)
	$hgui = GUICreate(" Toolbar button text accelerator prefix underscore test", 400, 150)
	GUISetBkColor(0xd3d3d3, $hgui)
	$hToolbar = _GUICtrlToolbar_Create($hgui)
	_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
	$aStrings[0] = _GUICtrlToolbar_AddString($hToolbar, "&New") ;chr(38) & "New"
	$aStrings[1] = _GUICtrlToolbar_AddString($hToolbar, "&Open");chr(38) & "Open"
	$aStrings[2] = _GUICtrlToolbar_AddString($hToolbar, "&Save");chr(38) & "Save"
	$aStrings[3] = _GUICtrlToolbar_AddString($hToolbar, "&Help");chr(38) & "Help"
	_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW, $aStrings[0], $bStyle)
	_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1], $bStyle)
	_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2], $bStyle)
	_GUICtrlToolbar_AddButtonSep($hToolbar)
	_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP, $aStrings[3], $bStyle)
	
	GUISetState()
	Sleep(1500)
	; add any one of these controls to remove all of the toolbar accelerator prefix underscores
	;GUICtrlCreateGroup("Group",150, 110, 100, 25)
	;GUICtrlCreateRadio("Radio", 150, 110, 100, 25)
	;GUICtrlCreateCheckbox("Checkbox", 150, 110, 100, 25)
	GUICtrlCreateButton("Button", 150, 110, 100, 25)
	
	$Label = GUICtrlCreateLabel(" Toolbar button text underscores may or may not be removed." & @CR & _
			" The problem is intermittant when run from SciTE, but consistent when compiled.", 10, 60, 380, 40)
	GUICtrlSetBkColor($Label, 0XFFFFFF)
	
	For $i = 0 To 3
		ConsoleWrite("-> BtnText:" & @TAB & _GUICtrlToolbar_GetButtonText($hToolbar, $i + 1000) & @CRLF)
		ConsoleWrite("-> StringPool:" & @TAB & _GUICtrlToolbar_GetString($hToolbar, $i) & @CRLF)
		ConsoleWrite("-> BtnStyle:" & @TAB & _GUICtrlToolbar_GetButtonStyle($hToolbar, $i + 1000) & @CRLF)
	Next
	
	Do
	Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>_Main
    Attachments (0)
Change History (2)
comment:1 Changed 18 years ago by Valik
- Resolution set to No Bug
- Status changed from new to closed
comment:2 Changed 18 years ago by rover
Thanks Valik, That was it.
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
Note: See
        TracTickets for help on using
        tickets.
    

I'm assuming that you have the option selected to "Hide underlined letters for keyboard navigation until I press the Alt key" checked (Display Properties -> Effects). Whenever I disable this option, I correctly see the underline always. When this option is enabled, you shouldn't expect to see the underline until you press the Alt key.
I don't see any behavior here that is bug-worthy.