Red box around 2 stacked contols

  1. 8 months ago

    Duane M

    19 Apr 2017 Pre-Release Testers, Xojo Pro Boston, MA

    I can't find any info on this and I know I've learned this once.

    If I place 2 or more controls on top of each other a red box appears around them. What's that mean? Does it just mean they share the same dimensions? Obviously if they are all visible and enabled then the top one in the stack hides the others.

    Is there a way to control the enabling and visibility of this "stack" of controls so that only one is visible based on some condition?

    Thanks.

    Or, in the control's Open event, use:

    me.parent = nil

    Which makes the control's parent the Window that it is placed on, not whatever control it is sitting on top of in the IDE.

    https://docs.xojo.com/index.php/RectControl.Parent

  2. Dave S

    19 Apr 2017 San Diego, California USA

    The control with the red box OWNS the other controls (ie. becomes their parent).... Normally you only do this for groupbox, pagepanel and other "container" types... but it also shows where you might have controls overlapping that really shouldn't be.

    if you want two controls to occupy the same space (but visible only one at a time).. What I do is place one control where you want it to be, then the other one somewhere else... Then in the OPEN event of the 2nd control, I have it set its own postion based on the position of the 1st control and toggle their VISIBLE property as required

  3. Duane M

    19 Apr 2017 Pre-Release Testers, Xojo Pro Boston, MA

    Thank you for the explanation. And I'll implement your suggested solution.

  4. Julian S

    19 Apr 2017 Pre-Release Testers, Xojo Pro UK

    Or place the 2nd control away from the 1st control, then move the 2nd using the Left and Top positions in the inspector into the same position as the 1st control. The two controls do not snap/group/embed together but they are at the same coordinates.

  5. Gavin S

    19 Apr 2017 Pre-Release Testers Answer UK
    Edited 8 months ago

    Or, in the control's Open event, use:

    me.parent = nil

    Which makes the control's parent the Window that it is placed on, not whatever control it is sitting on top of in the IDE.

    https://docs.xojo.com/index.php/RectControl.Parent

  6. Duane M

    19 Apr 2017 Pre-Release Testers, Xojo Pro Boston, MA

    me.parent = nil

    That's cool! I think that's the answer I like.

  7. Michel B

    20 Apr 2017 Pre-Release Testers, Xojo Pro

    Note that setting parent to nil is only possible in Desktop. if you ever develop for iOS, you will have to resort to the other techniques, since Parent there is read only.

or Sign Up to reply!