Results 1 to 8 of 8
  1. #1
    New Lounger
    Join Date
    Mar 2002
    Location
    Connecticut, USA
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Option Buttons odd behavior (Word 2000)

    Hi All,

    I'm having trouble getting options buttons to behave the way I'm used to. I've attached a document with a VBA form as well as a converted Wordbasic macro. The macro displays a dialog box with the same controls as the VBA form. However the tab key and the arrow keys work very differently.

    I would like my VBA form to work in a similar way to other windows forms. In other words, the Tab key should move the focus off the entire frame control to the next control instead of to the next option in the group. The arrow buttons should select the options when I'm in the option group.

    At the minimum if I know it isn't possible that would be helpful too!
    Attached Files Attached Files

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Option Buttons odd behavior (Word 2000)

    Hi Peter,
    Closest I can get to what you want is as follows:
    1. Set TabStop property of all option buttons except 'None' to False.
    2. Add code to the Enter event of each option button to set that option button's value to True.
    Does that help?
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    New Lounger
    Join Date
    Mar 2002
    Location
    Connecticut, USA
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Option Buttons odd behavior (Word 2000)

    Hi Rory,

    I had thought of that, but the problem there is if you tab back into the control it always goes to the None option and then selects it! If you make all the options tab stops then as you tab it doesn't leave the option group, but rather selects each in turn (this should only happen with the arrow keys).

    Sad to say the cure may be worse than the disease <img src=/S/alien.gif border=0 alt=alien width=14 height=15> !

    What I find odd is that the Wordbasic version has the correct Windows behavior!

  4. #4
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Option Buttons odd behavior (Word 2000)

    Oops - sorry about that! Should have finished my testing before I posted....
    Try:
    1. Set tab stops for all option buttons (but NOT frame) to false.
    2. Add Enter event code for each option button to set it to true.
    3. Add the following to the frame's enter event:
    <pre>Private Sub fraLevelOfUse_Enter()
    Select Case True
    Case optLevelOfUseNone
    optLevelOfUseNone.SetFocus
    Case optLevelOfUseMultiple
    optLevelOfUseMultiple.SetFocus
    Case optLevelOfUseContinuous
    optLevelOfUseContinuous.SetFocus
    Case optLevelOfUseReference
    optLevelOfUseReference.SetFocus
    Case Else
    End Select
    End Sub
    </pre>

    and I think ( <img src=/S/grin.gif border=0 alt=grin width=15 height=15>) that will do the trick.
    Regards,
    Rory

    Microsoft MVP - Excel

  5. #5
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Option Buttons odd behavior (Word 2000)

    We're talking apples and oranges here.

    You have not included any code for frmOpManCovPageEditor, so all Word can do is move the focus in TabIndex order when you use the Tab key. And this is the proper behavior.

    VBA Userforms do not work the same as WordBasic Dialogs. You have to include code for the VBA Userforms, but the resultant Userform is a heck of a lot vmore eficient than the WB Dialog.

    For example, in WB Dialogs, you have the ability to use an "OptionGroup", so when you select an OptionButton, TAB-bing moves out of the OptionGroup.
    VBA does not have OptionGroups, you have to write code to do the equivalent change of focus.

  6. #6
    New Lounger
    Join Date
    Mar 2002
    Location
    Connecticut, USA
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Option Buttons odd behavior (Word 2000)

    Thanks Howard,

    I'm actually not much of a WordBasic programmer.

    I do have to admit that I find it odd that one has to write code to get what would otherwise be standard Windows behavior <img src=/S/sad.gif border=0 alt=sad width=15 height=15>

    I actually spend much more time programming Visual Basic and Access (which of course have different form engines). For example in Visual Basic the behavior I speak of would require no code - just put some options in a frame and it behaves according to the Windows standard

    Regards,

    Peter

  7. #7
    New Lounger
    Join Date
    Mar 2002
    Location
    Connecticut, USA
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Option Buttons odd behavior (Word 2000)

    Bingo!

    Thanks for your help. Nice Select Statement trick by the way.

  8. #8
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Option Buttons odd behavior (Word 2000)

    I think that most of us expect VBA to be followed by something like VSA in some future version of Office.

    In VS.Net, the forms engine for ALL components is the same, i.e., a Windows forms engine.

    We can only hope that the Office components will also adopt the same forms engine.

    There are other subtle differences 'tween the VB and Office forms engines, solid evidence that the development groups do not adequately communicate at the company we all love.

    Oh well, this is the LAST posting I will make for quite some time in this and other forums. I've got to better allocate my time for other tasks.

    Bye bye fer now.

Posting Permissions

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