Announcement

Collapse
No announcement yet.

undeline using "&" is not working

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • David B Goodrich
    replied
    Thanks guys, the information was right on point.

    Leave a comment:


  • Dave Biggs
    replied
    Originally posted by David B Goodrich View Post
    The caption for button 1 is "&Save Files". The "S" is properly underlined in PowerBasic Forms...
    Tried with this test code..
    Code:
      DIALOG NEW hParent, "Dialog1", 259, 129, 201, 121, TO hDlg
      CONTROL ADD BUTTON, hDlg, %IDC_BUTTON1, "&Save Files", 75, 35, 50, 15
    While in PBForms Edit Mode Button text shows underlined Save Files.
    When Test mode selected by clicking toolbar icon, underline is NOT shown.
    When Test mode selected by Ctrl-T underline IS shown.

    If compiled and run on my machine, the underscore does not show until the Alt key is pressed - that's because I have the WinXP default windows display effect active. (Right click on the desktop, select Properties to see your setting):
    Display Properties/Appearance/Effects - "Hide underlined letters for keyboard navigation until I press the Alt key" - similar in Vista I believe.

    There are a couple of ways to circumvent the users' settings for your app.
    Search for "%WM_CHANGEUISTATE" (or "KeyBd_Event %VK_Menu" for a less elegant option).

    Here's an example of %WM_CHANGEUISTATE in action (Win2k or later)..
    Code:
    #PBForms Created V1.51
    #Compile Exe
    #Dim All
     
    #PBForms Begin Includes 
    #If Not %Def(%WINAPI)
      #Include "WIN32API.INC"
    #EndIf
    #PBForms End Includes
    '#RESOURCE "XPTheme.pbr"
     
    #PBForms Begin Constants 
    %IDOK        =    1
    %IDD_DIALOG1 =  101
    %BTN_BUTTON1 = 1001
    %BTN_BUTTON2 = 1002
    %BTN_BUTTON3 = 1003
    %BTN_BUTTON4 = 1004
    %BTN_BUTTON5 = 1005
    %BTN_BUTTON6 = 1006
    %BTN_BUTTON7 = 1007
    %BTN_CuesOn  = 1008
    %BTN_CuesOff = 1009
    %BTN_Focus   = 1010
    #PBForms End Constants
     
    Declare CallBack Function ShowDIALOG1Proc()
    Declare Function ShowDIALOG1(ByVal hParent As Dword) As Long
    #PBForms Declarations
     
    Function PBMain()
      ShowDIALOG1 %HWND_DESKTOP
    End Function
     
    CallBack Function ShowDIALOG1Proc()
     
      Select Case As Long CbMsg
        Case %WM_INITDIALOG
          Dialog Send CbHndl, %WM_CHANGEUISTATE, MakLng(%UIS_CLEAR, %UISF_HIDEFOCUS Or %UISF_HIDEACCEL), 0
          Control Set Focus CbHndl, %BTN_CuesOff
     
        Case %WM_NCACTIVATE
          Static hWndSaveFocus As Dword
          If IsFalse CbWParam Then
            hWndSaveFocus = GetFocus()
          ElseIf hWndSaveFocus Then
            SetFocus(hWndSaveFocus)
            hWndSaveFocus = 0
          End If
     
        Case %WM_COMMAND
          Select Case As Long CbCtl
            Case %BTN_BUTTON1
              If CbCtlMsg = %BN_CLICKED Or CbCtlMsg = 1 Then
                MsgBox "%BTN_BUTTON1=" + Format$(%BTN_BUTTON1), %MB_TASKMODAL
              End If
     
            Case %BTN_BUTTON2
              If CbCtlMsg = %BN_CLICKED Or CbCtlMsg = 1 Then
                MsgBox "%BTN_BUTTON2=" + Format$(%BTN_BUTTON2), %MB_TASKMODAL
              End If
     
            Case %BTN_BUTTON3
              If CbCtlMsg = %BN_CLICKED Or CbCtlMsg = 1 Then
                MsgBox "%BTN_BUTTON3=" + Format$(%BTN_BUTTON3), %MB_TASKMODAL
              End If
     
            Case %BTN_BUTTON4
              If CbCtlMsg = %BN_CLICKED Or CbCtlMsg = 1 Then
                MsgBox "%BTN_BUTTON4=" + Format$(%BTN_BUTTON4), %MB_TASKMODAL
              End If
     
            Case %BTN_BUTTON5
              If CbCtlMsg = %BN_CLICKED Or CbCtlMsg = 1 Then
                MsgBox "%BTN_BUTTON5=" + Format$(%BTN_BUTTON5), %MB_TASKMODAL
              End If
     
            Case %BTN_BUTTON6
              If CbCtlMsg = %BN_CLICKED Or CbCtlMsg = 1 Then
                MsgBox "%BTN_BUTTON6=" + Format$(%BTN_BUTTON6), %MB_TASKMODAL
              End If
     
            Case %BTN_BUTTON7
              If CbCtlMsg = %BN_CLICKED Or CbCtlMsg = 1 Then
                MsgBox "%BTN_BUTTON7=" + Format$(%BTN_BUTTON7), %MB_TASKMODAL
              End If
     
            Case %IDOK
              If CbCtlMsg = %BN_CLICKED Or CbCtlMsg = 1 Then
                MsgBox "%IDOK=" + Format$(%IDOK), %MB_TASKMODAL
              End If
     
            Case %BTN_CuesOn
              If CbCtlMsg = %BN_CLICKED Or CbCtlMsg = 1 Then
                Dialog Send CbHndl, %WM_CHANGEUISTATE, MakLng(%UIS_CLEAR, %UISF_HIDEFOCUS Or %UISF_HIDEACCEL), 0
              End If 
     
            Case %BTN_CuesOff
              If CbCtlMsg = %BN_CLICKED Or CbCtlMsg = 1 Then
                Dialog Send CbHndl, %WM_CHANGEUISTATE, MakLng(%UIS_SET, %UISF_HIDEFOCUS Or %UISF_HIDEACCEL), 0
                Control ReDraw CbHndl, GetDlgCtrlId(GetFocus)
              End If 
     
            Case %BTN_Focus
              If CbCtlMsg = %BN_CLICKED Or CbCtlMsg = 1 Then
                SendMessage CbHndl, %WM_NEXTDLGCTL, GetDlgItem(CbHndl, %BTN_Button1 + Rnd(0, 6)), 1
              End If           
     
          End Select
      End Select
    End Function
     
    Function ShowDIALOG1(ByVal hParent As Dword) As Long
      Local lRslt As Long
     
    #PBForms Begin Dialog %IDD_DIALOG1->->
      Local hDlg  As Dword
     
      Dialog New hParent, "Fun with Focus", 233, 200, 201, 121, %WS_POPUP Or %WS_BORDER Or %WS_DLGFRAME Or _
        %WS_CAPTION Or %WS_SYSMENU Or %WS_CLIPSIBLINGS Or %WS_VISIBLE Or %DS_MODALFRAME Or %DS_CENTER Or _
        %DS_3DLOOK Or %DS_NOFAILCREATE Or %DS_SETFONT, %WS_EX_CONTROLPARENT Or %WS_EX_LEFT Or _
        %WS_EX_LTRREADING Or %WS_EX_RIGHTSCROLLBAR, To hDlg
      Control Add Button, hDlg, %BTN_BUTTON1, "Button&1", 5, 5, 50, 15
      Control Add Button, hDlg, %BTN_BUTTON2, "Button&2", 5, 20, 50, 15
      Control Add Button, hDlg, %BTN_BUTTON3, "Button&3", 5, 35, 50, 15
      Control Add Button, hDlg, %BTN_BUTTON4, "Button&4", 5, 50, 50, 15
      Control Add Button, hDlg, %BTN_BUTTON5, "Button&5", 5, 65, 50, 15
      Control Add Button, hDlg, %BTN_BUTTON6, "Button&6", 5, 80, 50, 15
      Control Add Button, hDlg, %BTN_BUTTON7, "Button&7", 5, 95, 50, 15
      Control Add Button, hDlg, %BTN_CuesOn, "Cues O&n", 110, 5, 50, 15
      Control Add Button, hDlg, %BTN_CuesOff, "Cues Of&f", 110, 35, 50, 15
      Control Add Button, hDlg, %BTN_Focus, "&ShiftFocus", 110, 65, 50, 15
      Control Add Button, hDlg, %IDOK, "OK", 110, 95, 50, 15, %WS_CHILD Or %WS_VISIBLE Or %WS_TABSTOP Or _
        %BS_TEXT Or %BS_DEFPUSHBUTTON Or %BS_PUSHBUTTON Or %BS_CENTER Or %BS_VCENTER, %WS_EX_LEFT Or _
        %WS_EX_LTRREADING
      Dialog  Send        hDlg, %DM_SETDEFID, %IDOK, 0
    #PBForms End Dialog
     
      Dialog Show Modal hDlg, Call ShowDIALOG1Proc To lRslt
     
    #PBForms Begin CleanUp %IDD_DIALOG1
    #PBForms End CleanUp
     
      Function = lRslt
    End Function

    Leave a comment:


  • Dale Yarker
    replied
    Press & release <ALT> key and the underlines will appear.

    (This is by Windows, not PB.)

    Cheers,

    Leave a comment:


  • David B Goodrich
    started a topic undeline using "&" is not working

    undeline using "&" is not working

    The caption for button 1 is "&Save Files". The "S" is properly underlined in PowerBasic Forms but not when the source is compiled by Power Win 9. Is there something I need to set?
Working...
X