ReFreshing a Window

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

ReFreshing a Window

by Dimitri Holz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I use a resize() - methode to change a size of my window, but I do it in
a do-while-trails to see the change-effect:

void MyWindow::change_size()
{
    int x=100, y=100;
        do
        {          
            MyWindow::resize(x, y);
            .......................................................
            x++;
            y++;
        }while(x<800||y<800);      
}

but the problem is that you see only the first and the last size and I
can`t find a GtKmm-methode for refresh a window like    ::refresh()   ;
or   ::reload()    or so. How can I solve this problem?
_______________________________________________
gtkmm-list mailing list
gtkmm-list@...
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Re: ReFreshing a Window

by Joaquim Duran-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

En/na Dimitri Holz ha escrit:

> I use a resize() - methode to change a size of my window, but I do it in
> a do-while-trails to see the change-effect:
>
> void MyWindow::change_size()
> {
>     int x=100, y=100;
>         do
>         {          
>             MyWindow::resize(x, y);
>             .......................................................
>             x++;
>             y++;
>         }while(x<800||y<800);      
> }
>
> but the problem is that you see only the first and the last size and I
> can`t find a GtKmm-methode for refresh a window like    ::refresh()   ;
> or   ::reload()    or so. How can I solve this problem?
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list@...
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>
>

When a widget (including your window) is resized, the widget generates
an event to be redrawn, so the call to 'queue_redraw()' to force the
redraw of the window is not needed.

The problem is in your code: In a simple loop you are performing many
resize operations. Gtk and GTKmm is working based on events, so every
time you call to resize, an event is generated and queued, and all
generated events are processed once the loop is finished (the control
returns to main loop and new events are processed).

You should change the implementation of your function and use a timer,
in which at every timer callback an update should be done. For more
information:

http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/chapter-chapter-timeouts.html#sec-timeouts

Joaquim Duran
Thanks and Best Regards,

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

Re: ReFreshing a Window

by Dimitri Holz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dimitri Holz schrieb:

> I use a resize() - methode to change a size of my window, but I do it in
> a do-while-trails to see the change-effect:
>
> void MyWindow::change_size()
> {
>     int x=100, y=100;
>         do
>         {          
>             MyWindow::resize(x, y);
>             .......................................................
>             x++;
>             y++;
>         }while(x<800||y<800);      
> }
>
> but the problem is that you see only the first and the last size and I
> can`t find a GtKmm-methode for refresh a window like    ::refresh()   ;
> or   ::reload()    or so. How can I solve this problem?
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list@...
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>
> ANOTHER PROBLEM: the same code without loops: there are 2 buttons in the window and after resize they stay at the same place with the same size, only after the next event they refreshes theyselfes. How can you update them?

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

Re: ReFreshing a Window

by Paul Davis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Tue, 2008-05-13 at 18:25 +0200, Dimitri Holz wrote:

> Dimitri Holz schrieb:
> > I use a resize() - methode to change a size of my window, but I do it in
> > a do-while-trails to see the change-effect:
> >
> > void MyWindow::change_size()
> > {
> >     int x=100, y=100;
> >         do
> >         {          
> >             MyWindow::resize(x, y);
> >             .......................................................
> >             x++;
> >             y++;
> >         }while(x<800||y<800);      
> > }
> >
> > but the problem is that you see only the first and the last size and I
> > can`t find a GtKmm-methode for refresh a window like    ::refresh()   ;
> > or   ::reload()    or so. How can I solve this problem?
> > _______________________________________________
> > gtkmm-list mailing list
> > gtkmm-list@...
> > http://mail.gnome.org/mailman/listinfo/gtkmm-list
> >
> > ANOTHER PROBLEM: the same code without loops: there are 2 buttons in the window and after resize they stay at the same place with the same size, only after the next event they refreshes theyselfes. How can you update them?

its nothing to do with loops.

all GUI applications have this structure:

        main () {

                ... do some setup ....
       
                while (no_reason_to_exit) {

                    GUI_Toolkit_waits_for_events ();
                    GUI_Toolkit_calls_your_event_handlers ();
                    GUI_Toolkit_updates_windows();
                }


                ... do some shutdown stuff ...

        }

as you can hopefully see, nothing that you do inside any code you write
for an event handler (whether its a button press, or an idle handler or
whatever else) will be visible until the *next* iteration of the GUI
toolkit's "update windows" step.



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

Re: ReFreshing a Window

by Christopher Lang-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi,

maybe this helps:

 // computation going on
 while( Gtk::Main::events_pending() )
   Gtk::Main::iteration();

 // computation continued

see:
http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1Main.html#2a2a6cddef82f8c52026790f3f7887e0

Gtk::Main Class Reference


cheers
Chris

http://www.acurana.de/



Am Dienstag 13 Mai 2008 16:44:11 schrieb Dimitri Holz:

> I use a resize() - methode to change a size of my window, but I do it in
> a do-while-trails to see the change-effect:
>
> void MyWindow::change_size()
> {
>     int x=100, y=100;
>         do
>         {
>             MyWindow::resize(x, y);
>             .......................................................
>             x++;
>             y++;
>         }while(x<800||y<800);
> }
>
> but the problem is that you see only the first and the last size and I
> can`t find a GtKmm-methode for refresh a window like    ::refresh()   ;
> or   ::reload()    or so. How can I solve this problem?
> _______________________________________________
> 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
LightInTheBox - Buy quality products at wholesale price