Re: sleeping



On 09 Feb 2002 19:12:38 +0100
Sven Neumann <sven gimp org> wrote:

> Hi,
> 
> David Eduardo Gomez Noguera <davidgn servidor unam mx> writes:
> 
> > I am writing a program to control two steppers. To control its speed, i would need to sleep the function that moves them.
> > Is it safe to use sleep/nanosleep? or are there safer functions or a better way to do it than a callback from an Entry widget (where i get the command from)? (I was just thinking a long coulback could hang the app, am i right?)
> 
> I'd suggest you use the GTK+ main loop instead and install a timeout.
> Have a look at gtk_timeout_add().

what do you mean with the GTK+ main loop? havent done much with gtk, so my knowledge about gtk_main is limited to think that i run it only once.

I have seen gtk_timeout_add.
my function needs the two steppers to start and stop moving at the same time, so i use a line algorithm, and would need static variables there.
Also, i get the command to move the steppers from a GtkEntry widget, then i would need some way to not enable execution of new commands until the lastone ends (was thinking of gtk_object_set_data on the Entry, and a check each time to see if the timer exists.)
Can i "temporary" block signals from other widgets?
I also have a few buttons that affect the steppers, and would have to block them while executing a command.

Any help or pointer would be very appreciated... (i have a bad bad english)

Thank you.

> 
> 
> Salut, Sven
>  
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list


-- 
ICQ: 15605359 Bicho
                                  =^..^=
First, they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Gandhi.
........Por que no pensaran los hombres como los animales? Pink Panther........
-------------------------------気検体の一致------------------------------------
暑さ寒さも彼岸まで。
アン アン アン とっても大好き




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]