Sign in to follow this  
Followers 0
jennico

Ampersand (&) for underlining a shortcut

6 posts in this topic

hi there and merry christmas !

from helpfile:

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $defaultstatus, $status, $filemenu, $fileitem, $helpmenu, $saveitem
    Local $infoitem, $exititem, $recentfilesmenu, $separator1, $viewmenu
    Local $viewstatusitem, $okbutton, $cancelbutton, $statuslabel, $msg, $file
    
    GUICreate("My GUI menu", 300, 200)

    Global $defaultstatus = "Ready"
    Global $status

    $filemenu = GUICtrlCreateMenu("&File")
    $fileitem = GUICtrlCreateMenuItem("Open", $filemenu)
    GUICtrlSetState(-1, $GUI_DEFBUTTON)
    $helpmenu = GUICtrlCreateMenu("?")
    $saveitem = GUICtrlCreateMenuItem("Save", $filemenu)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $infoitem = GUICtrlCreateMenuItem("Info", $helpmenu)
    $exititem = GUICtrlCreateMenuItem("Exit", $filemenu)
    $recentfilesmenu = GUICtrlCreateMenu("Recent Files", $filemenu, 1)

    $separator1 = GUICtrlCreateMenuItem("", $filemenu, 2)   ; create a separator line

    $viewmenu = GUICtrlCreateMenu("View", -1, 1)    ; is created before "?" menu
    $viewstatusitem = GUICtrlCreateMenuItem("Statusbar", $viewmenu)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $okbutton = GUICtrlCreateButton("OK", 50, 130, 70, 20)
    GUICtrlSetState(-1, $GUI_FOCUS)
    $cancelbutton = GUICtrlCreateButton("Cancel", 180, 130, 70, 20)

    $statuslabel = GUICtrlCreateLabel($defaultstatus, 0, 165, 300, 16, BitOR($SS_SIMPLE, $SS_SUNKEN))

    GUISetState()
    While 1
        $msg = GUIGetMsg()
        
        If $msg = $fileitem Then
            $file = FileOpenDialog("Choose file...", @TempDir, "All (*.*)")
            If @error <> 1 Then GUICtrlCreateMenuItem($file, $recentfilesmenu)
        EndIf
        If $msg = $viewstatusitem Then
            If BitAND(GUICtrlRead($viewstatusitem), $GUI_CHECKED) = $GUI_CHECKED Then
                GUICtrlSetState($viewstatusitem, $GUI_UNCHECKED)
                GUICtrlSetState($statuslabel, $GUI_HIDE)
            Else
                GUICtrlSetState($viewstatusitem, $GUI_CHECKED)
                GUICtrlSetState($statuslabel, $GUI_SHOW)
            EndIf
        EndIf
        If $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton Or $msg = $exititem Then ExitLoop
        If $msg = $infoitem Then MsgBox(0, "Info", "Only a test...")
    WEnd
    GUIDelete()
EndFunc   ;==>Example

the ampersand should show "File" on the menu, but it doesn't on my computer, neither in my scripts. can anyone make a suggestion, while the underline does not show ? the ampersand itself doesn't show either, the menu text is just "File". what can i do, please ?

thx j.


I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.Don't forget this IP: 213.251.145.96

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

oops you're right.... i didn't know that. i was definitely thinking the underline should always be showing. maybe it can be set by windows somewhere....

thx a lot

j.

Edited by jennico

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.Don't forget this IP: 213.251.145.96

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

removed

Edited by rover

I see fascists...

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

As far as forcing a window to show them: WM_CHANGEUISTATE would be my initial item of research (it looks promising)

As far as the OS setting goes, its tucked away nicely (vista):

Control Panel >> Ease of Access >> Ease of Access Center >> Make the keyboard easier to use >> Underline keyboard shortcuts and access keys

Edit: Better still:

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer]
"NoChangeKeyboardNavigationIndicators"=dword:00000001

dword:00000001 shows the underlines,

dword:00000000 hides the underlines.

source

Edited by Mat

Share this post


Link to post
Share on other sites

That's definitely the topic you want... I should have known Melba had already done it :x

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  
Followers 0