inserting controls between controls

  • Thread starter Thread starter John Salerno
  • Start date Start date
J

John Salerno

If I want to create a button that adds text boxes to a form, how would I
write the code so that text boxes can be inserted between text boxes
that already exist?

For example, if this displays properly:

Main node 1
- child node (A)
- child node (B)
- child node
- child node
Main node 2
- child node
Main node 3
- child node
- child node

You get the idea. It's basically creating a tree hierarchy as the user
clicks the button. A new text box is added as a child node beneath the
currently selected text box.

What I'd like to know is, if I need to insert a text box somewhere (such
as between A and B above) how would I do this? Would I have to shift
everything down, or is there a method that allows insertion of controls?
 
John said:
If I want to create a button that adds text boxes to a form, how would I
write the code so that text boxes can be inserted between text boxes
that already exist?

For example, if this displays properly:

Main node 1
- child node (A)
- child node (B)
- child node
- child node
Main node 2
- child node
Main node 3
- child node
- child node

You get the idea. It's basically creating a tree hierarchy as the user
clicks the button. A new text box is added as a child node beneath the
currently selected text box.

What I'd like to know is, if I need to insert a text box somewhere (such
as between A and B above) how would I do this? Would I have to shift
everything down, or is there a method that allows insertion of controls?
There is no in-built method of inserting a control and having it
automagically layout everything nicely.
Would not be too hard to code though with the right design.

You could make a layout method which would layout your controls
depending on your hierarchy which you would call after you added your
next control.

Cheers
JB
 
Back
Top