Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 371
Default Selecting OptionButtons

Hi
Say for example there are 2 form optbuttons in a frame; is it possible to
tab to the required option and 'click' the button using the Enter key? If so
how?

My form has a number of optionbuttons amongst textboxes and it is becoming
tedious to keep reaching for the mouse to make a choice or confirm something.
It would be great to just use the keyboard as far as possible.

T.I.A

Geoff
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 221
Default Selecting OptionButtons

Spacebar, Geoff. :)
*******************
~Anne Troy

www.OfficeArticles.com


"Geoff" wrote in message
...
Hi
Say for example there are 2 form optbuttons in a frame; is it possible to
tab to the required option and 'click' the button using the Enter key? If

so
how?

My form has a number of optionbuttons amongst textboxes and it is becoming
tedious to keep reaching for the mouse to make a choice or confirm

something.
It would be great to just use the keyboard as far as possible.

T.I.A

Geoff



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Selecting OptionButtons

Probably not an issue but ensure that the option buttons properties are
correct. Tab Stop it True and Tab index is in the correct order...
--
HTH...

Jim Thomlinson


"Anne Troy" wrote:

Spacebar, Geoff. :)
*******************
~Anne Troy

www.OfficeArticles.com


"Geoff" wrote in message
...
Hi
Say for example there are 2 form optbuttons in a frame; is it possible to
tab to the required option and 'click' the button using the Enter key? If

so
how?

My form has a number of optionbuttons amongst textboxes and it is becoming
tedious to keep reaching for the mouse to make a choice or confirm

something.
It would be great to just use the keyboard as far as possible.

T.I.A

Geoff




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 371
Default Selecting OptionButtons

Spacebar works fine when focus is on a frame which has an Exit event with
Cancel = True clause. Thank you:):)

But in another part of the form I have 4 pairs of txtboxes, each pair
representing hours and minutes. After a correct entry, I move the focus by
SetFocus from one txtbox to the next. The first 3 pairs are summed after
entering minutes in the 3rd pair(box 6) and the total is shown in pair 4.

To assist data entry in the 3rd pair I have an optionbutton which reveals a
'totaliser' for that pair only. Using the mouse I can click for this
function before data is entered into the 3rd pair or just enter directly.

Here is the problem with the Spacebar solution.
Despite using tabstop=true and tab order etc I cannot navigate to this
option button to use the Spacebar, I assume because of the coded tabbing to
the 4th pair of boxes. Does this make sense?

I wondered if i should be using Application.OnKey somehow?

Geoff


"Anne Troy" wrote:

Spacebar, Geoff. :)
*******************
~Anne Troy

www.OfficeArticles.com


"Geoff" wrote in message
...
Hi
Say for example there are 2 form optbuttons in a frame; is it possible to
tab to the required option and 'click' the button using the Enter key? If

so
how?

My form has a number of optionbuttons amongst textboxes and it is becoming
tedious to keep reaching for the mouse to make a choice or confirm

something.
It would be great to just use the keyboard as far as possible.

T.I.A

Geoff




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Selecting OptionButtons

Geoff,

Do you have an accelerator key set on the option button?

Enter a character from the button caption in the "Accelerator"
property in the VBE.
Then use Alt + (that character) to activate the button.

Regards,
Jim Cone
San Francisco, USA


"Geoff" wrote in message ...
Spacebar works fine when focus is on a frame which has an Exit event with
Cancel = True clause. Thank you:):)

But in another part of the form I have 4 pairs of txtboxes, each pair
representing hours and minutes. After a correct entry, I move the focus by
SetFocus from one txtbox to the next. The first 3 pairs are summed after
entering minutes in the 3rd pair(box 6) and the total is shown in pair 4.

To assist data entry in the 3rd pair I have an optionbutton which reveals a
'totaliser' for that pair only. Using the mouse I can click for this
function before data is entered into the 3rd pair or just enter directly.

Here is the problem with the Spacebar solution.
Despite using tabstop=true and tab order etc I cannot navigate to this
option button to use the Spacebar, I assume because of the coded tabbing to
the 4th pair of boxes. Does this make sense?

I wondered if i should be using Application.OnKey somehow?

Geoff


"Anne Troy" wrote:

Spacebar, Geoff. :)
*******************
~Anne Troy

www.OfficeArticles.com


"Geoff" wrote in message
...
Hi
Say for example there are 2 form optbuttons in a frame; is it possible to
tab to the required option and 'click' the button using the Enter key? If

so
how?

My form has a number of optionbuttons amongst textboxes and it is becoming
tedious to keep reaching for the mouse to make a choice or confirm

something.
It would be great to just use the keyboard as far as possible.

T.I.A

Geoff






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 371
Default Selecting OptionButtons

Jim
Thanks for the reply.
That works fine in this layout. I have a number of frames to test but up to
now it has performed as needed. Because of the number of buttons and
similarity of captions i guess i will have to be inventive with the key
letter.

Accelerator plus spacebar plus tab order should give me plenty options
(sorry - couldn't resist that) to play with.

Thanks to all for their contribution.

Geoff

"Jim Cone" wrote:

Geoff,

Do you have an accelerator key set on the option button?

Enter a character from the button caption in the "Accelerator"
property in the VBE.
Then use Alt + (that character) to activate the button.

Regards,
Jim Cone
San Francisco, USA


"Geoff" wrote in message ...
Spacebar works fine when focus is on a frame which has an Exit event with
Cancel = True clause. Thank you:):)

But in another part of the form I have 4 pairs of txtboxes, each pair
representing hours and minutes. After a correct entry, I move the focus by
SetFocus from one txtbox to the next. The first 3 pairs are summed after
entering minutes in the 3rd pair(box 6) and the total is shown in pair 4.

To assist data entry in the 3rd pair I have an optionbutton which reveals a
'totaliser' for that pair only. Using the mouse I can click for this
function before data is entered into the 3rd pair or just enter directly.

Here is the problem with the Spacebar solution.
Despite using tabstop=true and tab order etc I cannot navigate to this
option button to use the Spacebar, I assume because of the coded tabbing to
the 4th pair of boxes. Does this make sense?

I wondered if i should be using Application.OnKey somehow?

Geoff


"Anne Troy" wrote:

Spacebar, Geoff. :)
*******************
~Anne Troy

www.OfficeArticles.com


"Geoff" wrote in message
...
Hi
Say for example there are 2 form optbuttons in a frame; is it possible to
tab to the required option and 'click' the button using the Enter key? If

so
how?

My form has a number of optionbuttons amongst textboxes and it is becoming
tedious to keep reaching for the mouse to make a choice or confirm

something.
It would be great to just use the keyboard as far as possible.

T.I.A

Geoff





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 371
Default Selecting OptionButtons

On further testing of Accelerator I have a problem.

I use a label to name an optbutton rather than its caption. When I set an
accelerator on the optbutton the function works fine. If I set an
accelerator on the label it does not, yet according to VB Help: 'If the
accelerator applies to a Label, the control following the Label in the tab
order, rather than the Label itself, receives the focus.'

Any further suggestions other than use the optbutton caption?

Geoff


"Geoff" wrote:

Jim
Thanks for the reply.
That works fine in this layout. I have a number of frames to test but up to
now it has performed as needed. Because of the number of buttons and
similarity of captions i guess i will have to be inventive with the key
letter.

Accelerator plus spacebar plus tab order should give me plenty options
(sorry - couldn't resist that) to play with.

Thanks to all for their contribution.

Geoff

"Jim Cone" wrote:

Geoff,

Do you have an accelerator key set on the option button?

Enter a character from the button caption in the "Accelerator"
property in the VBE.
Then use Alt + (that character) to activate the button.

Regards,
Jim Cone
San Francisco, USA


"Geoff" wrote in message ...
Spacebar works fine when focus is on a frame which has an Exit event with
Cancel = True clause. Thank you:):)

But in another part of the form I have 4 pairs of txtboxes, each pair
representing hours and minutes. After a correct entry, I move the focus by
SetFocus from one txtbox to the next. The first 3 pairs are summed after
entering minutes in the 3rd pair(box 6) and the total is shown in pair 4.

To assist data entry in the 3rd pair I have an optionbutton which reveals a
'totaliser' for that pair only. Using the mouse I can click for this
function before data is entered into the 3rd pair or just enter directly.

Here is the problem with the Spacebar solution.
Despite using tabstop=true and tab order etc I cannot navigate to this
option button to use the Spacebar, I assume because of the coded tabbing to
the 4th pair of boxes. Does this make sense?

I wondered if i should be using Application.OnKey somehow?

Geoff


"Anne Troy" wrote:

Spacebar, Geoff. :)
*******************
~Anne Troy

www.OfficeArticles.com


"Geoff" wrote in message
...
Hi
Say for example there are 2 form optbuttons in a frame; is it possible to
tab to the required option and 'click' the button using the Enter key? If
so
how?

My form has a number of optionbuttons amongst textboxes and it is becoming
tedious to keep reaching for the mouse to make a choice or confirm
something.
It would be great to just use the keyboard as far as possible.

T.I.A

Geoff




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Selecting OptionButtons

Geoff,
As Anne said: "spacebar"
Jim Cone


"Geoff" wrote in message
...
On further testing of Accelerator I have a problem.

I use a label to name an optbutton rather than its caption. When I set an
accelerator on the optbutton the function works fine. If I set an
accelerator on the label it does not, yet according to VB Help: 'If the
accelerator applies to a Label, the control following the Label in the tab
order, rather than the Label itself, receives the focus.'

Any further suggestions other than use the optbutton caption?

Geoff


"Geoff" wrote:

Jim
Thanks for the reply.
That works fine in this layout. I have a number of frames to test but up to
now it has performed as needed. Because of the number of buttons and
similarity of captions i guess i will have to be inventive with the key
letter.

Accelerator plus spacebar plus tab order should give me plenty options
(sorry - couldn't resist that) to play with.

Thanks to all for their contribution.

Geoff


  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default Selecting OptionButtons

Hi,
what about something like this:

Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As
Long) As Integer

Private Sub OptionButton1_Enter()
If GetAsyncKeyState(vbKeyMenu) And &H8000 Then OptionButton1.Value =
True
End Sub

Private Sub OptionButton1_KeyDown(ByVal KeyCode As
MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = Asc(UCase(Label1.Accelerator)) And Shift = 4 Then
OptionButton1.Value = True
End Sub

Private Sub OptionButton2_Enter()
If GetAsyncKeyState(vbKeyMenu) And &H8000 Then OptionButton2.Value =
True
End Sub

Private Sub OptionButton2_KeyDown(ByVal KeyCode As
MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = Asc(UCase(Label2.Accelerator)) And Shift = 4 Then
OptionButton2.Value = True
End Sub

--
HTH
okaizawa

Geoff wrote:
On further testing of Accelerator I have a problem.

I use a label to name an optbutton rather than its caption. When I set an
accelerator on the optbutton the function works fine. If I set an
accelerator on the label it does not, yet according to VB Help: 'If the
accelerator applies to a Label, the control following the Label in the tab
order, rather than the Label itself, receives the focus.'

Any further suggestions other than use the optbutton caption?

Geoff

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 371
Default Selecting OptionButtons

Hi okaizawa
Thats cool! Prime objective reached.

1. I can maintain the labels, which in a number of cases have to be above
the optbutton (hence no button captions).
2. It saves a key depression in operation, which with a detailed data entry
form saves time and patience - every little bit helps.

Again thanks to all for their help. Two solutions for one problem can't be
bad.

Geoff



"okaizawa" wrote:

Hi,
what about something like this:

Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As
Long) As Integer

Private Sub OptionButton1_Enter()
If GetAsyncKeyState(vbKeyMenu) And &H8000 Then OptionButton1.Value =
True
End Sub

Private Sub OptionButton1_KeyDown(ByVal KeyCode As
MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = Asc(UCase(Label1.Accelerator)) And Shift = 4 Then
OptionButton1.Value = True
End Sub

Private Sub OptionButton2_Enter()
If GetAsyncKeyState(vbKeyMenu) And &H8000 Then OptionButton2.Value =
True
End Sub

Private Sub OptionButton2_KeyDown(ByVal KeyCode As
MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = Asc(UCase(Label2.Accelerator)) And Shift = 4 Then
OptionButton2.Value = True
End Sub

--
HTH
okaizawa

Geoff wrote:
On further testing of Accelerator I have a problem.

I use a label to name an optbutton rather than its caption. When I set an
accelerator on the optbutton the function works fine. If I set an
accelerator on the label it does not, yet according to VB Help: 'If the
accelerator applies to a Label, the control following the Label in the tab
order, rather than the Label itself, receives the focus.'

Any further suggestions other than use the optbutton caption?

Geoff


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UserForm OptionButtons Horatio J. Bilge, Jr. Excel Discussion (Misc queries) 3 October 4th 07 07:52 PM
Moving OptionButtons MarkyB Excel Discussion (Misc queries) 2 March 7th 06 02:50 PM
OptionButtons Paul Excel Programming 4 December 4th 03 04:12 PM
Add OptionButtons in Excel Andrew Lenczycki Excel Programming 0 July 30th 03 02:34 PM
optionbuttons Phil Perry Excel Programming 1 July 10th 03 09:13 PM


All times are GMT +1. The time now is 04:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"