Loading ...
Sorry, an error occurred while loading the content.

Re: [libertybasic] Ampersand

Expand Messages
  • Bill Lopez
    Check the helpfile: The & character placed in the title and text items for the menu specifies the accelerator placement for each item. The letter
    Message 1 of 15 , Jun 9, 2009
    • 0 Attachment
      Check the helpfile:

      "The " & " character placed in the title and text items for the menu specifies the accelerator placement for each item. The letter directly following the " & " character will act as a hotkey for that menu item, when it is pressed while the user presses and holds down the ALT key. The hotkey appears underlined in the menu display."




      [Non-text portions of this message have been removed]
    • Matthew Funke
      ... It changes the letter one presses in order to take the indicated action via the keyboard. If we assume that all of these commands appear under the File
      Message 2 of 15 , Jun 9, 2009
      • 0 Attachment
        rnwolfe@... wrote:
        > Can someone tell me what "&" means?
        >
        > I see "save", "&save", and "s&ave" in various programs.


        It changes the letter one presses in order to take the indicated action via the keyboard.

        If we assume that all of these commands appear under the File menu, for example (which one can usually get to by pressing Alt-F), then one can invoke the save command by pressing "s" in the second case and "a" in the third. I *believe* the first case merely reverts to the default, but I could be mistaken.




        [Non-text portions of this message have been removed]
      • Harry
        I ;ve found that the statictext control won t display an ampersand. Is there a cure/workaround for that?
        Message 3 of 15 , Apr 25, 2012
        • 0 Attachment
          I';ve found that the statictext control won't display an ampersand. Is there a cure/workaround for that?
        • Stefan Pendl
          ... If the caption of a control includes an ampersand the letter following it is used as a keyboard accelerator. This is default Windows behavior and not
          Message 4 of 15 , Apr 25, 2012
          • 0 Attachment
            Am 25.04.2012 18:06, schrieb Harry:
            > I';ve found that the statictext control won't display an ampersand. Is there a cure/workaround for that?
            >

            If the caption of a control includes an ampersand the letter following
            it is used as a keyboard accelerator.
            This is default Windows behavior and not special to LB.

            Use a double ampersand (&&) to display one ampersand.


            --
            Stefan Pendl
            http://stefanpendl.runbasichosting.com/

            LB 4.04 Pro ... http://www.libertybasic.com/assist.html
            LB 4.04 ....... http://www.libertybasic.com/lb404setup.exe

            LB Community Wiki .............. http://basic.wikispaces.com/
            LB Programmer's Encyclopedia ... http://lbpe.wikispaces.com/
            LB Bug Tracker ................. http://libertybasicbugs.wikispaces.com/

            Books at http://www.lulu.com/ and http://www.amazon.com/
            Alyce Watson ... APIs for Liberty BASIC
            Carl Gundel .... Beginning Programming with Liberty BASIC

            Windows 7 Home Premium 64-bit SP1
            AMD Turion X2 RM-70 2GHz, 4GB RAM
          • Brandon Parker
            You can do as Stefan says and use && when you want a single ampersand symbol or you can add a style to prevent this type of behavior. The behavior has to do
            Message 5 of 15 , Apr 25, 2012
            • 0 Attachment
              You can do as Stefan says and use "&&" when you want a single ampersand symbol or you can add a style to prevent this type of behavior. The behavior has to do with the SS_NOPREFIX style. Basically if a static text does not have this style specified then it remove disregard the ampersand and underline the next character. Here is the link to the Stic Control Styles on MSDN:http://msdn.microsoft.com/en-us/library/aa923260.aspx Here is a short example of how to add this style to a StaticText control in Liberter BASIC.... '///////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' Begin Code'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/////////////////////////////////////NoMainWin
              StyleBits #Test.stc1, _SS_NOPREFIX, 0, 0, 0
              StaticText #Test.stc1, "Hello & World!!", 25, 25, 150, 25
              Open "Test" For Window As #Test
              Wait Sub quit handle$
              Close #handle$
              End Sub'///////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' End Code'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\///////////////////////////////////// {:0) Brandon

              To: libertybasic@yahoogroups.com
              From: harrybee99@...
              Date: Wed, 25 Apr 2012 16:06:49 +0000
              Subject: [libertybasic] Ampersand


























              I';ve found that the statictext control won't display an ampersand. Is there a cure/workaround for that?


















              [Non-text portions of this message have been removed]
            • Harry
              Thanks Stefan and Brandon. Always great to learn something. Now I see that the & causing underlining doesn t work with pushbutton labels. Is there a way,
              Message 6 of 15 , Apr 26, 2012
              • 0 Attachment
                Thanks Stefan and Brandon. Always great to learn something.

                Now I see that the & causing underlining doesn't work with pushbutton labels. Is there a way, other than using a bmpbutton, to make that happen? I don't see a style switch to impose that.

                --- In libertybasic@yahoogroups.com, Stefan Pendl <pendl2megabit@...> wrote:
                >
                > Am 25.04.2012 18:06, schrieb Harry:
                > > I';ve found that the statictext control won't display an ampersand. Is there a cure/workaround for that?
                > >
                >
                > If the caption of a control includes an ampersand the letter following
                > it is used as a keyboard accelerator.
                > This is default Windows behavior and not special to LB.
                >
                > Use a double ampersand (&&) to display one ampersand.
                >
                >
                > --
                > Stefan Pendl
                > http://stefanpendl.runbasichosting.com/
                >
                > LB 4.04 Pro ... http://www.libertybasic.com/assist.html
                > LB 4.04 ....... http://www.libertybasic.com/lb404setup.exe
                >
                > LB Community Wiki .............. http://basic.wikispaces.com/
                > LB Programmer's Encyclopedia ... http://lbpe.wikispaces.com/
                > LB Bug Tracker ................. http://libertybasicbugs.wikispaces.com/
                >
                > Books at http://www.lulu.com/ and http://www.amazon.com/
                > Alyce Watson ... APIs for Liberty BASIC
                > Carl Gundel .... Beginning Programming with Liberty BASIC
                >
                > Windows 7 Home Premium 64-bit SP1
                > AMD Turion X2 RM-70 2GHz, 4GB RAM
                >
              • Stefan Pendl
                ... Can we see some example code? -- Stefan Pendl http://stefanpendl.runbasichosting.com/ LB 4.04 Pro ... http://www.libertybasic.com/assist.html LB 4.04
                Message 7 of 15 , Apr 26, 2012
                • 0 Attachment
                  Am 26.04.2012 17:36, schrieb Harry:
                  > Thanks Stefan and Brandon. Always great to learn something.
                  >
                  > Now I see that the& causing underlining doesn't work with pushbutton labels. Is there a way, other than using a bmpbutton, to make that happen? I don't see a style switch to impose that.
                  >

                  Can we see some example code?


                  --
                  Stefan Pendl
                  http://stefanpendl.runbasichosting.com/

                  LB 4.04 Pro ... http://www.libertybasic.com/assist.html
                  LB 4.04 ....... http://www.libertybasic.com/lb404setup.exe

                  LB Community Wiki .............. http://basic.wikispaces.com/
                  LB Programmer's Encyclopedia ... http://lbpe.wikispaces.com/
                  LB Bug Tracker ................. http://libertybasicbugs.wikispaces.com/

                  Books at http://www.lulu.com/ and http://www.amazon.com/
                  Alyce Watson ... APIs for Liberty BASIC
                  Carl Gundel .... Beginning Programming with Liberty BASIC

                  Windows 7 Home Premium 64-bit SP1
                  AMD Turion X2 RM-70 2GHz, 4GB RAM
                • Rod
                  This is a sample from the distribution, I added a & to the button label text Red, &Red. If you still don t see the underlines then check windows help and
                  Message 8 of 15 , Apr 27, 2012
                  • 0 Attachment
                    This is a sample from the distribution, I added a & to the button label text Red, &Red. If you still don't see the underlines then check windows help and keyboard setting to be sure underline shortcuts is turned on. Control Panel\Ease of Access\Ease of Access Center\Make the keyboard easier to use tick underlinekeyboard shortcuts.

                    ' This is a turtle graphics demo for LB V2.0

                    nomainwin ' open no main window

                    size$ = "100"
                    size = val(size$)
                    color$ = "black"

                    button #1, "Triangle", [triangle], LR, 170, 10
                    button #1, "Square", [square], LR, 90, 10
                    button #1, "Size", [size], LR, 25, 10
                    button #1, "&Red", [colorRed], UL, 5, 5
                    button #1, "Blue", [colorBlue], UL, 46, 5
                    button #1, "Green", [colorGreen], UL, 95, 5
                    menu #1, &Colors, &red, [colorRed], &blue, [colorBlue], &green, [colorGreen]
                    menu #1, &Graph, &square, [square], &triangle, [triangle], &size, [size], |, &quit, [quit]
                    open "This is a turtle graphics window!" for graphics_nsb as #1

                    print #1, "trapclose [quit]"

                    'wait here for user interaction
                    wait


                    [triangle]

                    print #1, "color "; color$
                    print #1, "cls ; home ; down ; north"

                    for x = 1 to size
                    print #1, "turn 122 ; go "; str$(x*2)
                    next x

                    print #1, "flush"

                    'wait here for user interaction
                    wait


                    [square]

                    print #1, "color "; color$
                    print #1, "cls ; home ; down ; north"

                    for x = 1 to size
                    print #1, "turn 88 ; go "; str$(x*2)
                    next x

                    print #1, "flush"

                    'wait here for user interaction
                    wait


                    [colorRed]

                    color$ = "red"

                    'wait here for user interaction
                    wait


                    [colorBlue]

                    color$ = "blue"

                    'wait here for user interaction
                    wait


                    [colorGreen]

                    color$ = "green"

                    'wait here for user interaction
                    wait

                    [size]

                    prompt "What size figure?"; size$
                    size = val(size$)
                    if size > 0 then wait
                    beep
                    notice "Size must be > 0"
                    goto [size]


                    [quit]
                    confirm "Do you want to quit Buttons?"; quit$
                    if quit$ = "no" then wait
                    close #1
                    end





                    --- In libertybasic@yahoogroups.com, "Harry" <harrybee99@...> wrote:
                    >
                    > Thanks Stefan and Brandon. Always great to learn something.
                    >
                    > Now I see that the & causing underlining doesn't work with pushbutton labels. Is there a way, other than using a bmpbutton, to make that happen? I don't see a style switch to impose that.
                    >
                    > --- In libertybasic@yahoogroups.com, Stefan Pendl <pendl2megabit@> wrote:
                    > >
                    > > Am 25.04.2012 18:06, schrieb Harry:
                    > > > I';ve found that the statictext control won't display an ampersand. Is there a cure/workaround for that?
                    > > >
                    > >
                    > > If the caption of a control includes an ampersand the letter following
                    > > it is used as a keyboard accelerator.
                    > > This is default Windows behavior and not special to LB.
                    > >
                    > > Use a double ampersand (&&) to display one ampersand.
                    > >
                    > >
                    > > --
                    > > Stefan Pendl
                    > > http://stefanpendl.runbasichosting.com/
                    > >
                    > > LB 4.04 Pro ... http://www.libertybasic.com/assist.html
                    > > LB 4.04 ....... http://www.libertybasic.com/lb404setup.exe
                    > >
                    > > LB Community Wiki .............. http://basic.wikispaces.com/
                    > > LB Programmer's Encyclopedia ... http://lbpe.wikispaces.com/
                    > > LB Bug Tracker ................. http://libertybasicbugs.wikispaces.com/
                    > >
                    > > Books at http://www.lulu.com/ and http://www.amazon.com/
                    > > Alyce Watson ... APIs for Liberty BASIC
                    > > Carl Gundel .... Beginning Programming with Liberty BASIC
                    > >
                    > > Windows 7 Home Premium 64-bit SP1
                    > > AMD Turion X2 RM-70 2GHz, 4GB RAM
                    > >
                    >
                  • Harry
                    ... Sorry Stefan. I was whining that a button definition like this: button #m.f, &Find , [findit], UL, 20, 365, 50, 20 didn t display in its window with the
                    Message 9 of 15 , Apr 27, 2012
                    • 0 Attachment
                      --- In libertybasic@yahoogroups.com, Stefan Pendl <pendl2megabit@...> wrote:
                      >
                      > Can we see some example code?

                      Sorry Stefan. I was whining that a button definition like this:

                      button #m.f, "&Find", [findit], UL, 20, 365, 50, 20

                      didn't display in its window with the F underlined. Rod has stepped in and solved that.

                      Thanks, Rod.

                      Now I'll search for the API(s) that might read and toggle the state of that flag.

                      Harry
                    • Stefan Pendl
                      ... Press the ALT-key and the accelerators will get visible. -- Stefan Pendl http://stefanpendl.runbasichosting.com/ LB 4.04 Pro ...
                      Message 10 of 15 , Apr 27, 2012
                      • 0 Attachment
                        Am 27.04.2012 17:17, schrieb Harry:
                        > --- In libertybasic@yahoogroups.com, Stefan Pendl<pendl2megabit@...> wrote:
                        >>
                        >> Can we see some example code?
                        >
                        > Sorry Stefan. I was whining that a button definition like this:
                        >
                        > button #m.f, "&Find", [findit], UL, 20, 365, 50, 20
                        >
                        > didn't display in its window with the F underlined. Rod has stepped in and solved that.
                        >
                        > Thanks, Rod.
                        >
                        > Now I'll search for the API(s) that might read and toggle the state of that flag.
                        >
                        > Harry
                        >

                        Press the ALT-key and the accelerators will get visible.


                        --
                        Stefan Pendl
                        http://stefanpendl.runbasichosting.com/

                        LB 4.04 Pro ... http://www.libertybasic.com/assist.html
                        LB 4.04 ....... http://www.libertybasic.com/lb404setup.exe

                        LB Community Wiki .............. http://basic.wikispaces.com/
                        LB Programmer's Encyclopedia ... http://lbpe.wikispaces.com/
                        LB Bug Tracker ................. http://libertybasicbugs.wikispaces.com/

                        Books at http://www.lulu.com/ and http://www.amazon.com/
                        Alyce Watson ... APIs for Liberty BASIC
                        Carl Gundel .... Beginning Programming with Liberty BASIC

                        Windows 7 Home Premium 64-bit SP1
                        AMD Turion X2 RM-70 2GHz, 4GB RAM
                      • Rod
                        On my Win7 system the only way to get the underscore on the button label is to set the default. The alt key will toggle the menu underscore if it is off by
                        Message 11 of 15 , Apr 27, 2012
                        • 0 Attachment
                          On my Win7 system the only way to get the underscore on the button label is to set the default. The alt key will toggle the menu underscore if it is off by default but not the button label.

                          I would say that folks either use buttons or they use menus and shortcuts. I don't believe buttons should carry shortcuts as a matter of course. If folks use menu bars they expect shortcuts, folks who use buttons may be confused by the appearance of underlines even if Windows can be forced to support it.
                        • Stefan Pendl
                          ... It is all about accessibility. How about blind people using screen-readers, it is much easier for them to use the keyboard-accelerators than a mouse. See
                          Message 12 of 15 , Apr 27, 2012
                          • 0 Attachment
                            Am 27.04.2012 20:02, schrieb Rod:
                            > On my Win7 system the only way to get the underscore on the button label is to set the default. The alt key will toggle the menu underscore if it is off by default but not the button label.
                            >
                            > I would say that folks either use buttons or they use menus and shortcuts. I don't believe buttons should carry shortcuts as a matter of course. If folks use menu bars they expect shortcuts, folks who use buttons may be confused by the appearance of underlines even if Windows can be forced to support it.
                            >

                            It is all about accessibility.

                            How about blind people using screen-readers, it is much easier for them
                            to use the keyboard-accelerators than a mouse.

                            See the "Windows User Experience Interaction Guidelines" at
                            http://msdn.microsoft.com/en-us/library/aa511258.aspx for some hints.


                            --
                            Stefan Pendl
                            http://stefanpendl.runbasichosting.com/

                            LB 4.04 Pro ... http://www.libertybasic.com/assist.html
                            LB 4.04 ....... http://www.libertybasic.com/lb404setup.exe

                            LB Community Wiki .............. http://basic.wikispaces.com/
                            LB Programmer's Encyclopedia ... http://lbpe.wikispaces.com/
                            LB Bug Tracker ................. http://libertybasicbugs.wikispaces.com/

                            Books at http://www.lulu.com/ and http://www.amazon.com/
                            Alyce Watson ... APIs for Liberty BASIC
                            Carl Gundel .... Beginning Programming with Liberty BASIC

                            Windows 7 Home Premium 64-bit SP1
                            AMD Turion X2 RM-70 2GHz, 4GB RAM
                          • Harry
                            ... That works for menus, but not for buttons.
                            Message 13 of 15 , Apr 28, 2012
                            • 0 Attachment
                              > Press the ALT-key and the accelerators will get visible.
                              >

                              That works for menus, but not for buttons.
                            • Harry
                              Ah. I wasn t looking for the underlined letter to enforce a hot key on windows. In the application I m developing, which is an all-text app, one of the
                              Message 14 of 15 , Apr 28, 2012
                              • 0 Attachment
                                Ah. I wasn't looking for the underlined letter to enforce a hot key on windows. In the application I'm developing, which is an all-text app, one of the design objectives is for the user to be able to do everything from the keyboard. I'm looking for a way to indicate to the user what the hot key is for that button's function. At the moment, I have the activating key as a cap, with the rest in lower case, but I'd rather have it inderlined or bolded. Can be done using bmpbuttons, but then you've got the images adding to memory use, and getting a bmpbutton to act like a pubshutton -- changing state on focus and click -- is more of that and more code in an application that also aims to be lean and mean. (Mean in a nice sort of way.) Any ideas will be met with eternal gratitutde.

                                --- In libertybasic@yahoogroups.com, "Rod" <rodbird@...> wrote:
                                >
                                > On my Win7 system the only way to get the underscore on the button label is to set the default. The alt key will toggle the menu underscore if it is off by default but not the button label.
                                >
                                > I would say that folks either use buttons or they use menus and shortcuts. I don't believe buttons should carry shortcuts as a matter of course. If folks use menu bars they expect shortcuts, folks who use buttons may be confused by the appearance of underlines even if Windows can be forced to support it.
                                >
                              Your message has been successfully submitted and would be delivered to recipients shortly.