Programmatically setting scroll position of ScrolledWindow

View: New views
3 Messages — Rating Filter:   Alert me  

Programmatically setting scroll position of ScrolledWindow

by jody.xha :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

[Sorry accidentally hit the 'Send' Button to early
Hi
I have a Gtk::ScrolledWindow which is associated with two Gtk::Adjustments:

class test :  public Gtk::Window {
public:
   Gtk::Adjustment m_adjh;
   Gtk::Adjustment m_adjv;
   Gtk::ScrolledWindow m_scrW;

  ....
};


test::test()
:      m_adjh(50, 0, 100),
      m_adjv(50, 0, 100),
      m_scrW(m_adjh, m_adjv) {
....

}

Now i would like to set the 'scrollage' programmatically':

void test::setView(int iH, int iV) {
       m_adjh.set_value(iH);
       m_adjv.set_value(iV);
       m_scrW.set_vadjustment(m_adjh, m_adjv);

       repaintEverything();
}

But this does not seem to work.
Can anybody tell me how to do this?
Thank You
   Jody
_______________________________________________
gtkmm-list mailing list
gtkmm-list@...
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Re: Programmatically setting scroll position of ScrolledWindow

by Bartosz Kostrzewa-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

As far as I remember you need to set the adjustment first (during the
construction stage, for instance), then, each time you modify the
adjustment, the scrollbars should react accordingly.

-B.

jody wrote:

> [Sorry accidentally hit the 'Send' Button to early
> Hi
> I have a Gtk::ScrolledWindow which is associated with two Gtk::Adjustments:
>
> class test :  public Gtk::Window {
> public:
>    Gtk::Adjustment m_adjh;
>    Gtk::Adjustment m_adjv;
>    Gtk::ScrolledWindow m_scrW;
>
>   ....
> };
>
>
> test::test()
> :      m_adjh(50, 0, 100),
>       m_adjv(50, 0, 100),
>       m_scrW(m_adjh, m_adjv) {
> ....
>
> }
>
> Now i would like to set the 'scrollage' programmatically':
>
> void test::setView(int iH, int iV) {
>        m_adjh.set_value(iH);
>        m_adjv.set_value(iV);
>        m_scrW.set_vadjustment(m_adjh, m_adjv);
>
>        repaintEverything();
> }
>
> But this does not seem to work.
> Can anybody tell me how to do this?
> Thank You
>    Jody
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list@...
> http://mail.gnome.org/mailman/listinfo/gtkmm-list

_______________________________________________
gtkmm-list mailing list
gtkmm-list@...
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Re: Programmatically setting scroll position of ScrolledWindow

by Bartosz Kostrzewa-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Bartosz Kostrzewa wrote:
> As far as I remember you need to set the adjustment first (during the
> construction stage, for instance), then, each time you modify the
> adjustment, the scrollbars should react accordingly.
>
> -B.

>> Now i would like to set the 'scrollage' programmatically':
>>
>> void test::setView(int iH, int iV) {
>>        m_adjh.set_value(iH);
>>        m_adjv.set_value(iV);

Let me rephrase this, I think this line is extraneous and should be
removed (as you corrently construct test with the two adjustments):

>>        m_scrW.set_vadjustment(m_adjh, m_adjv);

>>
>>        repaintEverything();
>> }
>>

_______________________________________________
gtkmm-list mailing list
gtkmm-list@...
http://mail.gnome.org/mailman/listinfo/gtkmm-list