Issue with nested Controls

I have noticed that if I have a control inside another control (ex: Canvas inside another Canvas) If I try to manipulate one canvas it modifies every canvas inside it.

The only reason I have them inside on another is purely for visual reference during IDE mode as everything is done on one Canvas but I need a way to visualize it so I know can where elements in the Canvas are going to be but it is annoying that the Visualize Canvases move when I manipulate the Main one. Is there a way to stop it from doing that?

You should be utilizing one canvas to do all of your drawing. You are going to run into a number of issues with overlapping canvases, especially on Windows. Back to the main point, what you are running into is actually a feature for grouping controls together and reposition them as an entire group.

To prevent the IDE from automatically making an overlapped control the child of one you drag it into, you must position the child control manually with the Top and Left fields in the Inspector. Dragging it will automatically make it a child, you can tell this is about to happen when you see the parent control shows a red glow.

Or you can set Parent = Nil in code to break the grouping relationship.

First of all I already said it is purely for visualization in the IDE and everything is done on one Canvas.

Second I’ll check that out.

EDIT: Nope doesn’t work. Also setting Parent = Nil in code does me no good since I only use these Canvases for Visualization in the IDE. They are not actually being used at Run Time.

On Windows, overlapping canvas is a BIG NO NO. I tried many tricks, it is simply not possible. Draw everything in one canvas and everything will be fine.

AND, don’t leave the unused canvas over the one where you draw. Put them out of the window area.

Guys, Charles has already stated that this is For Position Only. It’s for keeping things straight at design-time in the IDE.

That said, Charles. There’s no easy way to unparent controls in the ide. Your best bet would be to make sure the guide controls are not completely contained in the parent control.

Even with parent = nil, canvases drawing interfere. Don’t leave the canvas used to position in the IDE over the window.

The canvases are strictly so I can see where elements that are drawn at runtime to the main canvas will be. They are not used at all during runtime.

There really should be an easy way to stop controls from being linked to another control.

File a feature request for it, but I would argue that what you are doing is an edge-case.

nvm misread thread

@Charles Fasano I’d put a feature request in for an Alt keyboard modifier (Alt on windows, dont know what the equivalent is on macos) to allow movement of controls without them being made a child of whatever they are hovering over.

Hopefully with the incoming development of custom controls built with Xojo there will be an IDE paint method/event/system, you could then implement this as a custom control so you could visualise your positions when in the IDE. Xojo take note, I’ll be marking you out of 10 on this when it launches “soon” ™®© :wink: :smiley:

I am having another weird issue which appears to be with nesting. I go to manually change the width of a Window and several controls in the Window go ahead and resize themselves when I hit return but only a few and not all. None of them should resize.

Check if the controls which resize have the lock symbol set for the right edge. It sounds like you have locked some control widths to be relative to the parent.

Didn’t even realize they were. Thanks.