How to set wxWIndow::SetScrollbar() start position

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
cneng3
Knows some wx things
Knows some wx things
Posts: 26
Joined: Sat Apr 28, 2018 7:43 pm

How to set wxWIndow::SetScrollbar() start position

Post by cneng3 »

Hello all,

Is it possible to set the start position of a scrollbar, which is enabled by wxWIndow::SetScrollbar(), to any number I want, instead of 0?
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7479
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: How to set wxWIndow::SetScrollbar() start position

Post by ONEEYEMAN »

Hi,
Which platform/wx version?
For Windows - see this.

Thank you.
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to set wxWIndow::SetScrollbar() start position

Post by doublemax »

For "real" scrolled windows use wxScrolled< T >::Scroll( int x, int y ):
http://docs.wxwidgets.org/trunk/classwx ... d065907f69

There is also wxWindow::ScrollWindow(...), but the docu says:
Scrolling and scrollbars functions

Note that these methods don't work with native controls which don't use wxWidgets scrolling framework (i.e. don't derive from wxScrolledWindow).
Use the source, Luke!
cneng3
Knows some wx things
Knows some wx things
Posts: 26
Joined: Sat Apr 28, 2018 7:43 pm

Re: How to set wxWIndow::SetScrollbar() start position

Post by cneng3 »

I'm using wxWidgets 3.0.4 on Windows 10, but the GUI should be cross-platform so I don't want to use any Windows API. The existing code already uses wxWindow::SetScrollbar() to set the scrollbar, so I'm just looking for a quick fix for this problem but sounds like it's pretty complicated.
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to set wxWIndow::SetScrollbar() start position

Post by doublemax »

The existing code already uses wxWindow::SetScrollbar() to set the scrollbar
Can you show some of the code in context, so that we can see what classes are used.

If you have existing code that uses wxWindow::SetScrollbar() and it works, then wxWindow::SetScrollPos() might work, too. Did you try it?
Use the source, Luke!
Post Reply