[Top][All Lists]

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

Re: [XForms] Looking for simple example

From: Jens Thoms Toerring
Subject: Re: [XForms] Looking for simple example
Date: Sat, 8 Nov 2014 14:20:36 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Sat, Nov 08, 2014 at 12:13:00PM +0000, jon wrote:
> I am having problems with timers, the examples are little over complex.
> All I am after is a callback to run every 100ms or so for the entire
> time the form is active, but the examples seem rather over clever.
> I get this output and no timer ticks ?
> In fl_add_object() [objects.c:258]: NULL form for 'FL_TIMER'
> I am trying something like this, but so far it is not working out :  
> FL_OBJECT *tim;
> void timertick(FL_OBJECT *obj, long q)
> {
>         printf("timer\n");
>         fflush(stdout);
> //fl_set_timer(tim,100);

You'll have to uncomment this line if you want to restart
the timmer. It doesn't restart automatically.

> }
> int main( int argc, char * argv[ ] )
> {
>     FD_mixerform *fd_mixerform;
>     fl_initialize( &argc, argv, 0, 0, 0 );
>     fd_mixerform = create_form_mixerform( );
>     tim = fl_add_timer(FL_HIDDEN_TIMER,100,0,0,0,"Time"); 

A timer object is not special - it also needs to be associated
with a form. At at this moment there's no form "open" for adding
objects, so the fl_add_object() funtion (called by fl_ad_timer())
doesn't know which form the new object is to be added to and re-
fuses to do anything (thus no timer is created). You'll either
have to add the timer object somewhere when one of the forms is
still "open" (between calls of fl_bgn_form() and fl_end_form()
as you'll find them in the code generated by fdesign) or you
have to "reopen" one of your forms, using fl_addto_form(). Then
you can add more objects like your timer. Afterwards you should
"close" the form again by calling fl_end_form().

In your case probably this

   fl_addto_form( fd_mixerform->mixerform );
   tim = fl_add_timer(FL_HIDDEN_TIMER,100,0,0,0,"Time"); 
   fl_end_form( );

will do the trick.
                        Best regards, Jens
  \   Jens Thoms Toerring  ________      address@hidden
   \_______________________________      http://toerring.de

reply via email to

[Prev in Thread] Current Thread [Next in Thread]