How to manage controls that overlap

I just learned that if I place a BevelButton on top of a TextArea, they have the same TabOrder. Potentially that has advantages if I’m tabbing around.
Questions:
I couldn’t get one control to be visible and the other not. Is this normal or something?

What are the advantages?

How does one use this?

have you tried toggling the VISIBLE property of each control?

It is set to visible and the textArea is too. When they overlap the TextArea gets a red border indicating I think it’s the TabOrder, because they merge?

the red border indicates that is the “parent” of the selected control…

Interesting. I can have a bevel button inside of a textArea? I’m pretty sure that isn’t the case.

How can I find information about this? It’s not under TabOrder and z-order isn’t around.

I didn’t say it was a good idea… I was just telling you what the red meant… in some cases it just to let you know that the DO overlap… not that you should.

perhaps the dozens of documents and manuals that came installed with Xojo? just an idea.

[quote]@Dave S 2 hours ago San Diego, California USA
have you tried toggling the VISIBLE property of each control?[/quote]
I just realized you were not referring to the IDE, but in the debugger etc. They should alternate on an off.

In other words, I have the button not visible while the TextArea is visible and of course vice versa.

To be more specific for the sets. I have a set of 3 TextAreas that are paired with BevelButtons.
I chose for this exercise of finding visibility, I put 2 directly over and left one separate.
If I have the button, now paired with the text, set by code to visible and the Texture should be not visible, then nothing shows in that spot, and the button is by uhmm XOJO to be not visible. In other words the whole pair are not visible and the code is over-ridden.
I can get screen shot if I’m clear.

Code and Images. The OTWord is the Control Array of TextAreas. The OTImage is the Control Array of BevelButtons. They move to the same vertical height.

OTImage(0).Visible = False OTWord(0).Visible = True OTImage(1).Visible = True OTImage(1).Top = 140 OTWord(1).Visible = False OTImage(2).Visible = True OTImage(2).Top = 260 OTWord(2).Visible = False

Correct Showing for BevelButtons

Buttons Merged with TextAreas

TextAreas showing

As Dave pointed out, the red border indicates that one control (the BevelButton) is a “child” of the outer control. You will find in the debugger that the bevelbutton’s Parent property is set to the TextArea. When you set a control to not visible, all of its children are set not visible as well. It sounds like you need to break the parent/child relationship. You can do that by setting the bevelbutton’s Parent to Nil in code.

Thank you Tim. I had not noticed there was a property “Parent” in the list available for a control. I also hadn’t read it until today.

So. It is clear now that I don’t know about managing parent-child relationships.

My intent for asking the question is just for knowledge.
What else can be achieved by giving a control a parent, besides the obvious of properties like Enabled or Visible?

When I lookup RectControl.Parent, there is a reference to http://documentation.xojo.com/index.php/RectControl but that doesn’t even mention parent.

When you hide the parent control all its child controls will also be hidden.

Why not a PagePanel?

+1

Thanks, Markus, but that isn’t practical since I have 2 separate control arrays.
I don’t have the intention of doing that with these controls.
I am asking only because I can’t find anything about this.
My question isn’t really about what other options are available, but what else happens if I happen to have eg a BevelButton with a parent of TextArea? I understand about GroupBox but there isn’t much you can do with that, I think.
I will look at a pagepanel as an option though.

This describes the function of a pagepanel.

That shouldn’t matter. Putting them on pagepanels doesn’t interfere with them being control arrays.

Thanks. Tim. It will make things easier.

Sorry, I didn’t answer that part of your question. When controls are associated in a parent/child relationship, what happens to the parent affects the children in terms of:

  • Visible
  • Enabled
  • Left/Top - move the parent, the children move with it
  • Close - close the parent, the children close as well
    There are advantages to grouping controls this way, but there are also unexpected consequences if you didn’t intend to group them, as you have discovered.

[quote=375197:@Arthur Gabhart]Thanks, Markus, but that isn’t practical since I have 2 separate control arrays.
I don’t have the intention of doing that with these controls.
I am asking only because I can’t find anything about this.
My question isn’t really about what other options are available, but what else happens if I happen to have eg a BevelButton with a parent of TextArea? I understand about GroupBox but there isn’t much you can do with that, I think.
I will look at a pagepanel as an option though.[/quote]

Layering controls is a receipt for desaster (especially on Windows). And what you want to do is what PagePanels are for.

Thanks Markus. I agree 100%, but it was more wondering if there was any use for it. Thanks also for the word layering. I didn’t search for that.

P.S. just to make sure: you are aware that a PagePanel does not need to cover the whole window, and that you can have more than one PagePanel on a window? It’s basically like an invisible TabPanel that you control in code, just without the tabs.