Hi Im creating a double slider using wxwidgets
Im almost done but the main issue im having now is that the slider is not resizing with the window. My idea was to use a scaling function but that does not work. The slider is drawn using dc paint and the code is in https://github.com/fahadbandali/updatedmediaplayer and the files I have been using are myDoubleSlider and play
sorry about the code being messy
I have attached a photo of my custom widget, basically what I need to do is that the bar and the max slider needs to reach the end of the window
Window Sizing
Window Sizing
- Attachments
-
- update.PNG (5.59 KiB) Viewed 1056 times
Re: Window Sizing
You should stop using absolute positions and sizer and start using sizers instead, both for the frame and inside the "myDoubleSlider" as well.
https://docs.wxwidgets.org/trunk/overview_sizer.html
http://neume.sourceforge.net/sizerdemo/
In the slider control, you should have a dedicated wxPanel for the area where you draw the custom slider. Then but this panel and the wxSpinCtrl next to each other into a horizontal boxsizer.
In the drawing code you should use the actual size of the drawing panel and scale everything accordingly. (At least for the width, you could use a fixed height)
https://docs.wxwidgets.org/trunk/overview_sizer.html
http://neume.sourceforge.net/sizerdemo/
In the slider control, you should have a dedicated wxPanel for the area where you draw the custom slider. Then but this panel and the wxSpinCtrl next to each other into a horizontal boxsizer.
In the drawing code you should use the actual size of the drawing panel and scale everything accordingly. (At least for the width, you could use a fixed height)
Use the source, Luke!
Re: Window Sizing
Hi,
It looks like from you description that you paint it yourself and you are using the hardocded values.
And you also didn't derive you control from the wxWindow.
Am I correct?
It looks like from you description that you paint it yourself and you are using the hardocded values.
And you also didn't derive you control from the wxWindow.
Am I correct?
Re: Window Sizing
You should to handle wxSizeEvent.
Re: Window Sizing
im using .GetLogicalPosition(dc) in order to get the value of a slider on a certain point on the bar, I dont think the slider will move if I were to make these changes
Re: Window Sizing
Hi,
Are you asking about slider or a thumbnail?
Thank you.
Are you asking about slider or a thumbnail?
Thank you.
Re: Window Sizing
by slider i mean the red slider at 1000
Last edited by bandali99 on Fri Jul 12, 2019 10:48 pm, edited 1 time in total.
Re: Window Sizing
Hi,
You should inherit from the wxControl (or even better from wxWindow) and use sizers to layout controls.
Or you could also try to re-use the generic implementation of the control.
wxWidgets is known to use native controls whenever possible, so if you want something that weird you should switch to something else.
Thank you.
You should inherit from the wxControl (or even better from wxWindow) and use sizers to layout controls.
Or you could also try to re-use the generic implementation of the control.
wxWidgets is known to use native controls whenever possible, so if you want something that weird you should switch to something else.
Thank you.