List Info

Thread: Re: "ocaml_beginners"::[] Re: multiple callbacks




Re: "ocaml_beginners"::[] Re: multiple callbacks
country flaguser name
Germany
2007-09-20 11:58:06
Am Mittwoch 19 September 2007 23:13:34 schrieb Florent
Monnier:
>
>
> the problem is that in the small sample example,
dump_list() simulates
> events in the library that makes call the callbacks,
and with your solution
> the library won't be able to call individualy each
callbacks.

how does the lib know which callback to call?

> (Sorry your solution does work with my small sample
example, because I
> haven't made a complete event management in the sample,
I don't even know
> how to do this in C, lol)

there are many: fltk2, qt, gtk2  (I find fltk2 simple)

 Michael


Archives up to November 11, 2006 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners/

The archives of the very official ocaml list (the seniors'
one) can be found at http://caml.inria.fr
Attachments are banned and you're asked to be polite, avoid
flames etc. 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http:/
/groups.yahoo.com/group/ocaml_beginners/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    ht
tp://groups.yahoo.com/group/ocaml_beginners/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:ocaml_beginners-digest@yahoogroups.com 
    mailto:ocaml_beginners-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    ocaml_beginners-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.c
om/info/terms/
 

Re: "ocaml_beginners"::[] Re: multiple callbacks
country flaguser name
France
2007-09-21 02:21:16
> how does the lib know which callback to call?

It depends each time. There are some in several modules of
the lib,
there are several kinds of function with callbacks as
argument: for drawing, 
for packaged file management, for timers, for animations on
frames, also in 
its custom gui, and to add new file format management as
here is this 
exemple:

(by default, only .wav and .voc sound files are handledby
the lib)

  SAMPLE *load_mp3(const char *filename) {
       ...
  }
  SAMPLE *load_ogg(const char *filename) {
       ...
  }

  register_sample_file_type("mp3", load_mp3,
NULL);
  register_sample_file_type("ogg", load_ogg,
NULL);

So as you can see here, the function
register_sample_file_type() can be called 
with *several* different callbacks, in this example the
correct callback will 
be called according to the file type when the user calls
  load_sample(filename);

(but when callbacks are called is different for each
function of the different 
modules of the lib related to what does each function)

As said previously a hack have to be found to bind this kind
of functions,
since the method given in the ocaml manual will not work
here.


Archives up to November 11, 2006 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners/

The archives of the very official ocaml list (the seniors'
one) can be found at http://caml.inria.fr
Attachments are banned and you're asked to be polite, avoid
flames etc. 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http:/
/groups.yahoo.com/group/ocaml_beginners/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    ht
tp://groups.yahoo.com/group/ocaml_beginners/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:ocaml_beginners-digest@yahoogroups.com 
    mailto:ocaml_beginners-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    ocaml_beginners-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.c
om/info/terms/
 

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )