Alpha Video Training
Results 1 to 12 of 12

Thread: Multistate buttons using keyboard?

  1. #1
    Jake Vuckovic
    Guest

    Default Multistate buttons using keyboard?

    Looks like there is no way to navigate/push multistate buttons using keyboard. Anyone has a solution/suggestion?

    Thanks...

  2. #2
    "Certified" Alphaholic
    Real Name
    jim chapman
    Join Date
    Apr 2000
    Posts
    1,779

    Default RE: Multistate buttons using keyboard?

    Hi Jake,

    >>Looks like there is no way to navigate/push multistate buttons using keyboard

  3. #3
    Jake Vuckovic
    Guest

    Default RE: Multistate buttons using keyboard?

    Thank you Jim,
    I knew it could be done with hotkeys, but my question was about actually pushing the buttons, and moving through the buttons using keyboard.
    Did you notice that, when multistate button is active, user can move with arrow keys from button to button, but none of them are selectable. They somehow "change" the shape, but cannot be pushed by "Enter" key.
    Anyhow, that's what I was after.

    Thanks again,
    Jake

  4. #4
    Member
    Real Name
    Jack Wheeler
    Join Date
    Apr 2000
    Posts
    570

    Default RE: Multistate buttons using keyboard?

    Hi Jake,
    I think this can be done, I will try it tonight, I think that you get the name of the active button while using the arrow key, then placing a sript on the OnKey event for the enter key it presses the appropriate button. The trick is to get the 'so called active' button value. Jack

  5. #5
    Member
    Real Name
    Jack Wheeler
    Join Date
    Apr 2000
    Posts
    570

    Default RE: Multistate buttons using keyboard?

    This will work for you:

    ''XBasic
    dim val as c
    dim shared num as n
    if this.active()="MULSTBTN1" then
    if num

  6. #6
    Jake Vuckovic
    Guest

    Default RE: Multistate buttons using keyboard?

    Jack,
    Thank you very much for your effort. I changed num=num-11 and num=num+11 (had to be a typo) to num=num-1/+1, and it works most of the time. I think at some point it looses the track of choice list (num) value. I will have to play with it little bit more.

    Unfortunately, as you might have seen, you can't always tell which button the focus is on. In my case it's not a big problem, since I am working with only 4 buttons laid out horizontally.
    But, it would be nice if this control had all this(keyboard navigation) built in. Selwyn, are you there?

    Jack, many thanks again, for this and all the help in the past.

    Live long and prosper!

    Jake

  7. #7
    Jake Vuckovic
    Guest

    Default RE: Multistate buttons using keyboard?

    Jack,
    I was wrong, it does work all the time. And, I realized that num=num+11 was not a typo, it depends on the number of buttons accross and down.

    Jake

  8. #8
    Member
    Real Name
    Jack Wheeler
    Join Date
    Apr 2000
    Posts
    570

    Default RE: Multistate buttons using keyboard?

    Hi Jake, yes my button I tried was a 22 button multistate. 11 on one side and 11 on the other and it did work all the time. Did you figure out how to change the individual color? Perhaps if it is less than three buttons you can do something like this

    ''XBasic
    dim val as c
    dim txt as c
    dim shared num as n
    txt=""
    if this.active()="MULSTBTN1" then
    if num

  9. #9
    Member
    Real Name
    Jack Wheeler
    Join Date
    Apr 2000
    Posts
    570

    Default RE: Multistate buttons using keyboard?

    Hi Jake, sorry for this repeated message, but------> I tried my little script and noticed that if you started out on a number that is the first one, num=0, the first button would loose a character, and if the last button did not change the number back to one the button would loose focus. Here is the update

    ''XBasic
    dim val as c
    dim txt as c
    dim shared num as n
    txt=""
    if this.active()="MULSTBTN1" then
    if num>0 then
    Mulstbtn1.choice.list[num].text=substr(Mulstbtn1.choice.list[num].text,2,len(Mulstbtn1.choice.list[num].text))
    end if
    if num22 then
    num=1
    end if

    txt=Mulstbtn1.choice.list[num].text
    Mulstbtn1.choice.list[num].text=chr(169)+txt
    Mulstbtn1.refresh()
    MULSTBTN1.activate()
    if a_user.key.value="{ENTER}" then
    if a_user.key.event="down" then
    a_user.key.handled=.t.
    Mulstbtn1.value=Mulstbtn1.choice.list[num].value
    Mulstbtn1.refresh()
    end if
    end if
    end if

    I know you wil follow this very well. Now if we went ahead and changed the colors of all buttons background colors to winback when active (using the class() function the user can easily toggle through every form easily. I will try this later as well. Jack

  10. #10
    Jake Vuckovic
    Guest

    Default RE: Multistate buttons using keyboard?

    Hi Jack,

    I got it to work like a charm. Even the buttons are now clearly distinguishable when moving around, and there is no need to press Enter key, it's actually better that way.

    I have not figured the way to change individual colors. I'll give it a try later.

    Made a little changes to the script:

    dim val as c
    dim txt as c
    dim shared num as n
    txt=""
    if this.active()="MULSTBTN1" then
    if num>0 then
    Mulstbtn1.choice.list[num].text=substr(Mulstbtn1.choice.list[num].text,2,len(Mulstbtn1.choice.list[num].text))
    end if
    if num4 then 'looping around caused multiple chr(169)
    num=4 'to build up on first button,I don't want it to loop around anyway
    end if

    txt=Mulstbtn1.choice.list[num].text
    Mulstbtn1.choice.list[num].text=chr(169)+txt
    Mulstbtn1.value=Mulstbtn1.choice.list[num].value
    Mulstbtn1.refresh()
    MULSTBTN1.activate()
    'took out this part, now works without need to press Enter
    'if a_user.key.value="{ENTER}" then
    'if a_user.key.event="down" then
    'a_user.key.handled=.t.
    'Mulstbtn1.value=Mulstbtn1.choice.list[num].value
    'Mulstbtn1.refresh()
    'MULSTBTN1.activate()
    'end if
    'end if
    end if

    Jack, thanks a million.

    Jake

  11. #11
    Member
    Real Name
    Jack Wheeler
    Join Date
    Apr 2000
    Posts
    570

    Default RE: Multistate buttons using keyboard?

    Hey Jake, I am so happy that you got everything to work wonderfully, however, when I tried your way I noticed that everytime I hit the right or left arrow key it activated the button. Therefore if you are going to use the arrow keys to toggle between the buttons you cannot set the multistate button's value. When you are using your buttons, how do you find that this works better for you instead of hitting the enter key? I think you are using the button for a different thing I am not familar with. Jack

  12. #12
    Jake Vuckovic
    Guest

    Default RE: Multistate buttons using keyboard?

    Jack,
    I moved this line(see above):

    Mulstbtn1.value=Mulstbtn1.choice.list[num].value

    just after we set the button's text, and then we do refresh. The value is being set, as I am using OnChange event to do the stuff based on the value.
    It works for me.
    But, I am having trouble tabbing out of multistate. Still working on it.

    Jake

Similar Threads

  1. Multistate Genie
    By Keith Hubert in forum Archived Wishlist
    Replies: 16
    Last Post: 06-13-2008, 04:43 PM
  2. Multistate & Radio Buttons
    By Tom Cone Jr in forum Code Archive
    Replies: 1
    Last Post: 05-16-2005, 03:18 PM
  3. MultiState Button ?
    By Keith Hubert in forum Alpha Five Version 6
    Replies: 3
    Last Post: 01-24-2005, 11:28 AM
  4. MultiState Button
    By nick marodis in forum Alpha Five Version 4
    Replies: 2
    Last Post: 01-31-2001, 05:25 AM
  5. Multistate Buttons - Variable Declaration
    By Clifford Rathkopf Jr. in forum Alpha Five Version 4
    Replies: 3
    Last Post: 04-15-2000, 05:54 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •