Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with TabOrder & Edit boxes within GroupBox 1

Status
Not open for further replies.

Stretchwickster

Programmer
Apr 30, 2001
1,746
0
0
GB
Hi,

I know how to use the TabStop and TabOrder properties to change the tabbing order when the form is run. However, I have a form with 2 GroupBoxes, each GroupBox contains 3 edit boxes. Also on the form are 2 buttons. I've set the 3 edit box tab orders to 0, 1, 2 in the first GroupBox, but the second GroupBox won't let me continue with 3, 4, 5. Basically the edit boxes seem to run on a different tab order to that of the GroupBoxes & buttons!

Can anyone help?
 
if you want your taborder flow to go

group1:edit1
group1:edit2
group1:edit3
group2:edit4
group2:edit5
group2:edit6

you have to give the following

group1 (0)
group2 (1)

group1:edit1 (0)
group1:edit2 (1)
group1:edit3 (2)
group2:edit4 (0)
group2:edit5 (1)
group2:edit6 (2)
 
This is the order i want:

group1:edit1
group1:edit2
group1:edit3
group2:edit4
group2:edit5
group2:edit6
button1
button2

All the components have tabstop = true and i have already entered the following taborder:
group1:edit1 (0)
group1:edit2 (1)
group1:edit3 (2)
group2:edit4 (0)
group2:edit5 (1)
group2:edit6 (2)
group1 (0)
group2 (1)
button1 (2)
button2 (3)

But when i run the app and tab thru the components, it goes like this:

group1:edit1
button1
button2

and doesn't tab to any other components.

Anyone know why?

 
I think, but not sure, your group boxes need TabStop = false and the Edit boxes are Tabstop = true.

Are the buttons on a separate panel? if so, their parent panel needs tabstop = false and taborder = 2 - the buttons will have tabstop = true and ordered as 0 and 1.

So, in plain english, the parents on the controls have tabstop = false (and ordered separately, which you know), then the child controls have tabstop = true and their order then organised within each parent control.

hope this is some help :eek:)

lou
 
the problem is the groupbox, it used to group items
where you would only make 1 choice so it sends the focus away ..

best to group your edits on a panel .. :)
 
Lou: Thanks for your suggestion - but it still doesn't work. My buttons are just loose on the form (not on any panel). The run-time order still follows this order: Group1:Edit1 then Button1 then Button2!

Aaron: I think that's probably the best idea! But group boxes don't necessarily contain mutually exclusive components (i.e. radio buttons). I could understand that kind of behaviour for a RadioGroup!
 
Problem with a TPanel or TBevel is, as far as i can see, you can't have a caption on it like you can with a TGroupBox. And that is pretty much an essential! ;-)
 
I have just tested this scenario in D5Ent, and can find no problem [smile]. Try it with a new project, and see what you get. The order of creation that I used was:

GroupBox1 (with TabStop=false, which seems to be the default anyway)
GroupBox2 (with TabStop=false)
Edit1 (in GroupBox1)
Edit2 (in GroupBox1)
Edit3 (in GroupBox1)
Edit4 (in GroupBox2)
Edit5 (in GroupBox2)
Edit6 (in GroupBox2)
Button1
Button2

Running this gives me a perfect taborder like you need. If it works for a new project, edit the (not working) form as text, and check the fields manually. This normally works faster when bugtracking than using the Object Inspector. Also check whether the fields are enabled [dazed]. Cheers,
Nico
 
Thank you very much Nico!!! You deserve a star!!!

I tried creating a new project and the tab order worked fine. I compared the forms (in notepad) and there was no difference between any of the applicable properties! So, I deleted all the components from my troublesome form and re-dropped them and everything works perfectly. I have absolutely no idea why it messed up the first time - sorry for wasting your time!! ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top