can ScrolledWindow resize with mouseWheel?

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.
gpu
Experienced Solver
Experienced Solver
Posts: 92
Joined: Tue Aug 12, 2014 3:46 am

can ScrolledWindow resize with mouseWheel?

Post by gpu » Wed Aug 20, 2014 8:48 am

can ScrolledWindow resize with mouseWheel, and meanwhile the children controls such as buttons are also resized.

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

Re: can ScrolledWindow resize with mouseWheel?

Post by doublemax » Wed Aug 20, 2014 9:03 am

Not automatically. You'd have to resize everything yourself manually. Of course with native controls that would not work or look very ugly.
Use the source, Luke!

gpu
Experienced Solver
Experienced Solver
Posts: 92
Joined: Tue Aug 12, 2014 3:46 am

Re: can ScrolledWindow resize with mouseWheel?

Post by gpu » Wed Aug 20, 2014 9:10 am

doublemax wrote:Not automatically. You'd have to resize everything yourself manually. Of course with native controls that would not work or look very ugly.
thank u and i will have a try.

gpu
Experienced Solver
Experienced Solver
Posts: 92
Joined: Tue Aug 12, 2014 3:46 am

Re: can ScrolledWindow resize with mouseWheel?

Post by gpu » Tue Aug 26, 2014 9:54 am

I resize with myPanel(by the way get the original size in the constructor, and then multiply the new scale with it ),
BUT the promble is that the children controls(all kinds of controls, eg button, combo, label, etc) which I didn't inheritie from wxButton, wx****, so I can't get the original size in the constructor and then multiply with scale......I can just SetSize, BUT the next time I GetSize the result is the size I set last time but not the original size....any good solutioin for this?
thank u
ps. I use Fit() to decide the parent myPanel size now, is there any way to resize the myPanel and then let the children controls to move to their new positions and get their new size with some SIZER?

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

Re: can ScrolledWindow resize with mouseWheel?

Post by doublemax » Tue Aug 26, 2014 9:47 pm

Actually i think (especially considering the other questions you've asked regarding your project) that you'll have to use 100% custom drawing in the end. You probably won't get very far using native controls.
ps. I use Fit() to decide the parent myPanel size now, is there any way to resize the myPanel and then let the children controls to move to their new positions and get their new size with some SIZER?
Even if this worked, the controls will never change their font size according to their outer size. You'll always have to adjust that manually for each control.

Maybe you could try to remember the panel's outer size when it's at 100%, so that you always have a base value for your scaling calculations.
Use the source, Luke!

gpu
Experienced Solver
Experienced Solver
Posts: 92
Joined: Tue Aug 12, 2014 3:46 am

Re: can ScrolledWindow resize with mouseWheel?

Post by gpu » Wed Aug 27, 2014 1:59 am

doublemax wrote:Maybe you could try to remember the panel's outer size when it's at 100%, so that you always have a base value for your scaling calculations.
yes, i do remember the myPanel size when it's 100%...my question is that the chilren controsl on it, of course i can remember all there size, but I think it's a silly way, I want to know whether is there a smarter way by using the API already have.
(2) And u mean I can't change the font size on StaticText, TextCtrl ? So assume I want to deal it with the controls, can i remember their size and then change them too?
(3) the most important is how to do my 100% drawing, now the controls are all created and then just add as children of the myPanel
Thanks for ur great help:)

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

Re: can ScrolledWindow resize with mouseWheel?

Post by doublemax » Wed Aug 27, 2014 6:43 am

but I think it's a silly way, I want to know whether is there a smarter way by using the API already have.
I have to admit, i can't think of any more elegant way at the moment.
And u mean I can't change the font size on StaticText, TextCtrl ?
You can. As long as you're only scaling up, this might even work for most controls. I'm just not sure, what happens, if for example to want to scale a wxComboBox down to 50%. This is something you should definitely try out before pursuing this path any further.
Use the source, Luke!

gpu
Experienced Solver
Experienced Solver
Posts: 92
Joined: Tue Aug 12, 2014 3:46 am

Re: can ScrolledWindow resize with mouseWheel?

Post by gpu » Fri Aug 29, 2014 2:38 am

the most important is how to do my 100% drawing, now the controls are all created and then just add as children of the myPanel
Can I draw all the controls by my self?
/////////////////
I just tried scale, the wxStaticBimap and wxStaticText can resize through SetSize, but...the bitmap and text on it...are not resized....can i control them? and how to deal with more complicated controls like combo and editbox,etc
I will try more controls....

gpu
Experienced Solver
Experienced Solver
Posts: 92
Joined: Tue Aug 12, 2014 3:46 am

Re: can ScrolledWindow resize with mouseWheel?

Post by gpu » Fri Aug 29, 2014 8:53 am

met a wired problem. I mannually scale all the panels and the controls on it.
when I scale up, it seems ok...
but when i scale down(make them smaller), the controls on the panel seems draw first before the parent panel's background so that the controls seems at the bottom of the parent panel's backgound(i draw a bitmap as the semi-transparent background). BUT when i pan the whole window, or create a new panel, or drag the panel, or refresh in the panel's EnterWindow event. It come back to normal appearence(the controls on the backgound)....
And I tried refresh...all of the them....the controls, the panel...but still didnt work

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

Re: can ScrolledWindow resize with mouseWheel?

Post by doublemax » Fri Aug 29, 2014 9:59 am

I just tried scale, the wxStaticBimap and wxStaticText can resize through SetSize, but...the bitmap and text on it...are not resized....can i control them?
You have to scale the bitmap and set a new one for the wxStaticBimap and you have to recalculate a new font size for the wxStaticText.

I told you this would be ugly ;)
Use the source, Luke!

gpu
Experienced Solver
Experienced Solver
Posts: 92
Joined: Tue Aug 12, 2014 3:46 am

Re: can ScrolledWindow resize with mouseWheel?

Post by gpu » Fri Aug 29, 2014 11:10 am

ok,i know it ,lol:)
how about this?
the most important is how to do my 100% drawing, now the controls are all created and then just add as children of the myPanel
Can I draw all the controls by my self?

gpu
Experienced Solver
Experienced Solver
Posts: 92
Joined: Tue Aug 12, 2014 3:46 am

Re: can ScrolledWindow resize with mouseWheel?

Post by gpu » Fri Aug 29, 2014 11:15 am

gpu wrote:met a wired problem. I mannually scale all the panels and the controls on it.
when I scale up, it seems ok...
but when i scale down(make them smaller), the controls on the panel seems draw first before the parent panel's background so that the controls seems at the bottom of the parent panel's backgound(i draw a bitmap as the semi-transparent background). BUT when i pan the whole window, or create a new panel, or drag the panel, or refresh in the panel's EnterWindow event. It come back to normal appearence(the controls on the backgound)....
And I tried refresh...all of the them....the controls, the panel...but still didnt work
and this question?
I have some controls on a small panel, and the small panel on a big panel, then big panels on scrollwindow
if the big and small panel both draw semi-transparent bitmap background, when scale down I will have problem(it seems that the drawing belong to parent, draws wrong...) I guess it's because the draw order...but I debug and get the result the parent's drawing always fisrt and it should be no problem...and i want to know is there refresh API except Refresh()?

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

Re: can ScrolledWindow resize with mouseWheel?

Post by doublemax » Fri Aug 29, 2014 11:28 am

the most important is how to do my 100% drawing, now the controls are all created and then just add as children of the myPanel
Can I draw all the controls by my self?
You can't draw native controls yourself, that's what makes them native. When i said "100% custom" i actually thought of re-implementing them from scratch.

You could try wxRendererNative, but i've never used it myself, so i don't know how complete its implementation is.
http://docs.wxwidgets.org/trunk/classwx ... ative.html

The good thing is that all its method take a wxDC& as parameter, so when you call wxDC::SetUserScale(...) before passing it, you can get zooming with little effort.
Last edited by doublemax on Fri Aug 29, 2014 11:30 am, edited 1 time in total.
Use the source, Luke!

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

Re: can ScrolledWindow resize with mouseWheel?

Post by doublemax » Fri Aug 29, 2014 11:30 am

if the big and small panel both draw semi-transparent bitmap background, when scale down I will have problem(it seems that the drawing belong to parent, draws wrong...) I guess it's because the draw order...but I debug and get the result the parent's drawing always fisrt
Can you post a screenshot?

If the parent-child relationships are correct, this shouldn't happen.
Use the source, Luke!

gpu
Experienced Solver
Experienced Solver
Posts: 92
Joined: Tue Aug 12, 2014 3:46 am

Re: can ScrolledWindow resize with mouseWheel?

Post by gpu » Sat Aug 30, 2014 2:06 pm

1 is the normal one
2 is the wrong effect when scale down......some controls on the small panel "disappear"
3 when I move mouse on the small panel(I change the background color in the EnterWindow event), or pan the backgound wxScrollWindow, or move the big panel(owns the 4 small panel), the wrong effect on the small panel will be right...not all these above call Refresh manually.......HOWEVER, I tried, refresh the small panel, the big panel, the wxScrollWindow, in the order small to big and big to small(both tried), still have the same wrong effect.
4 shows the rightTop small panel become "right" as I do in the 3 step above
ps. don't consider the controls' position and size, I know it's not right now, I'm still working on it.
thank you:)
Last edited by gpu on Sun Aug 31, 2014 1:32 am, edited 1 time in total.

Post Reply