Creating a custom widget that has other widgets in absolute positions? Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Midnightas
Knows some wx things
Knows some wx things
Posts: 39
Joined: Fri Feb 02, 2018 1:48 pm

Creating a custom widget that has other widgets in absolute positions?

Post by Midnightas »

I'm creating something like a timeline of sorts, where each "thing" on the timeline (not a layer, as there is only one row) is in an absolute position.
I read on how to create a custom widget that contains other existing widgets, but most examples force you to draw the widget yourself or something similar.
Another way I've found is to create a class that derives btBoxSizer, but that doesn't work since wxBoxSizer causes non-absolute positioning.
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Creating a custom widget that has other widgets in absolute positions?

Post by doublemax »

if you derive your class e.g. from wxWindow or wxPanel, you can position children of this control with absolute coordinates (relative to their parent).

See the "pos" and "size" parameters:
http://docs.wxwidgets.org/trunk/classwx ... b4994f922e
Use the source, Luke!
Post Reply