BoxSizers 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
Knows some wx things
Knows some wx things
Posts: 40
Joined: Fri Jul 05, 2019 3:58 pm


Post by bandali99 » Tue Aug 13, 2019 9:20 pm

Hi, I am using boxsizers to create a timeline media player. I used a similar format from an older media player I had made early (thanks to doublemax).

I'm running into two formating issues the first being that I want to scale the media bars in relation to the longest bar. Currently, I have them completely expanded.

I have a link to the git if the code provided isnt enough:

but I have a feeling the issue has something to do with my sizers here and maybe I need to add proportions?

Code: Select all

	slider4sizer->Add(slider4check, 1, wxLEFT);
	slider4sizer->Add(TimeText4, 1, wxRIGHT);
	slider4sizer->Add(FrameText4, 1, wxRIGHT);

	playerSizer->Add(slide, 4, wxEXPAND);
	player2Sizer->Add(slide2, 3, wxEXPAND);

	player3Sizer->Add(slide3, 2, wxEXPAND);

	player4Sizer->Add(slide4, 1, wxEXPAND);

	mediaSizer->Add(playerSizer, 1, wxEXPAND);
	mediaSizer->Add(player2Sizer, 1, wxEXPAND);
	mediaSizer->Add(player3Sizer, 1, wxEXPAND);
	mediaSizer->Add(player4Sizer, 1, wxEXPAND);
The next issue is minor but if any has an idea that would be awesome- I want the media bars to align directly in the middle of each textbox in their row.
timeline.PNG (27.73 KiB) Viewed 321 times

User avatar
Posts: 15651
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: BoxSizers

Post by doublemax » Tue Aug 13, 2019 10:07 pm

Code: Select all

playerSizer->Add(slider1sizer, 0, wxALIGN_CENTER_VERTICAL);
playerSizer->Add(slide, 1000, wxEXPAND);

player2Sizer->Add(slider2sizer, 0, wxALIGN_CENTER_VERTICAL);
player2Sizer->Add(slide2, 750, wxEXPAND);

player3Sizer->Add(slider3sizer, 0, wxALIGN_CENTER_VERTICAL);
player3Sizer->Add(slide3, 500, wxEXPAND);

player4Sizer->Add(slider4sizer, 0, wxALIGN_CENTER_VERTICAL);
player4Sizer->Add(slide4, 250, wxEXPAND);
The values like (1000-750) need to be calculated by the actual ranges of the sliders always based on the biggest one.
Use the source, Luke!

Post Reply