Jump to content
dormky

How do I tab into a TDBRadioGroup ?

Recommended Posts

I have a TDBRadioGroup with 2 options. Unfortunately, when pressing TAB to go from field to field, when it gets to the TDBRadioGroup you can't edit the values via keyboard. I tried space, enter and arrows, all with shift and ctrl.

What's the deal here ? Is there no way to actually give the focus to this type of field and edit it via keyboard ?

 

The TabOrder is correct and TabStop is True. Strangely enough, once you've clicked on an option it suddenly becomes available in the TAB navigation, and at the expected order. Not sure what's happening here, is it because there is no default value (none of the options are selected at first) ?

Edited by dormky

Share this post


Link to post
21 hours ago, dormky said:

I have a TDBRadioGroup with 2 options. Unfortunately, when pressing TAB to go from field to field, when it gets to the TDBRadioGroup you can't edit the values via keyboard. I tried space, enter and arrows, all with shift and ctrl.

What's the deal here ? Is there no way to actually give the focus to this type of field and edit it via keyboard ?

 

The TabOrder is correct and TabStop is True. Strangely enough, once you've clicked on an option it suddenly becomes available in the TAB navigation, and at the expected order. Not sure what's happening here, is it because there is no default value (none of the options are selected at first) ?

A radio group, by its very nature, must have one of the options checked. If you need to indicate that none of your two options applies then that has to be added as a third option that is checked as default. What type of database field have you tied the group to?

Share this post


Link to post
19 hours ago, PeterBelow said:

A radio group, by its very nature, must have one of the options checked. If you need to indicate that none of your two options applies then that has to be added as a third option that is checked as default. What type of database field have you tied the group to?

It's a VARCHAR(1), for the sex. The default value is empty, so none of the values are checked, which makes sense.

Share this post


Link to post

Try setting the TabStop property of Radiogroup to True when none of the controls are selected. In the RadioGroups.OnEnter set focus on a control so keys can change the selection as needed.

 

//Need RG .TabStop prop set to True to 'focus' the groupbox when its control index
//is -1;
procedure TformInstructorStation.RadioGroup2Enter(Sender: TObject);
begin
  with Sender as TRadioGroup do
    if ItemIndex = -1 then
      TRadioButton(Controls[0]).SetFocus;

 //(Sender as TRadioGroup).OnEnter := nil;
end;

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×