From f7e4caec2575619b6578b866bb59630bb513049c Mon Sep 17 00:00:00 2001 From: Bill Spitzak Date: Tue, 20 Jun 2000 05:47:38 +0000 Subject: Whoops, I screwed up the timeout callbacks a bit. add_timeout will now do the callback at time t after the call to add_timeout, like before. add_interval_timeout is a new call that measures time from when the last timeout was called. This has slightly less overhead and allows accurate spacing of timeouts. Patch from Stuart Levy so the *last* widget in an Fl_Pack may be resizable. This should be compatable because resizable didn't do anything before so there was no reason to set it. Makefiles for no-cygwin from Paul Baxter (see README.win32 for info). git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@1222 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- documentation/functions.html | 46 +++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 18 deletions(-) (limited to 'documentation/functions.html') diff --git a/documentation/functions.html b/documentation/functions.html index 162b89400..a79bdd1fd 100644 --- a/documentation/functions.html +++ b/documentation/functions.html @@ -282,8 +282,10 @@ in future versions, however. Adds a callback function that is called every time by Fl::wait() and also makes it act as though the timeout is -zero (so it just checks for events and returns immediately). This can -be used to get background processing done. +zero (this makes Fl::wait() return immediately, so if it is +in a loop it is called repeatedly, and thus the idle fucntion is +called repeatedly). The idle function can be used to get background +processing done.

You can have multiple idle callbacks. To remove an idle callback use Fl::remove_idle(). @@ -295,26 +297,34 @@ but Fl::ready() does not. Fl::wait(), Fl::check(), and Fl::ready(). Fltk will not recursively call the idle callback. -

static void Fl::add_timeout(float t, void -(*cb)(void*),void*v=0)

+

static void Fl::add_timeout(float t, void (*cb)(void*),void*v=0)

Add a one-shot timeout callback. The function will be called by -Fl::wait() at t seconds after this function is called -(except if you call this inside a timeout callback, then the time is -measured from when the callback was done, to allow accurate repeating -events). The optional void* argument is passed to the -callback. +Fl::wait() at t seconds after this function is called. +The optional void* argument is passed to the callback. -

This code will print "TICK" each second on stdout: +

static void Fl::add_interval_timeout(float t, void (*cb)(void*),void*v=0)

+ +Add a one-shot timeout callback. The difference from add_timeout is that the time is measured from +when the last timeout callback was called, rather than from the moment +this function is called (if no timeout has been called recently the +time is measured from the next call to Fl::wait). This is designed +for making regularly-spaced timeouts at high speed (like for movie +playback), it also has slightly less system-call overhead than +add_timeout. + +

This code will print "TICK" each second on stdout, with a +fair degree of accuracy:

static int Fl::arg(int argc, char **argv, int &i)

@@ -509,7 +519,7 @@ pick an item with a single click. Don't pass non-zero to this.
int Fl::get_key(int) Fl::event_key() returns which key on the keyboard was last -pushed. +pushed. It returns zero if the last event was not a key press or release.

Fl::event_key(int) returns true if the given key was held down (or pressed) during the last event. This is constant until @@ -955,9 +965,9 @@ Fl_Widget::test_shortcut().

static int Fl::visual(int)

-Selects a visual so that your graphics are drawn correctly. You must -do this before calling show() on any windows. This does nothing if -the default visual satisfies the capabilities, or if no visual +Selects a visual so that your graphics are drawn correctly. This is +only allowed before you call show() on any windows. This does nothing +if the default visual satisfies the capabilities, or if no visual satisfies the capabilities, or on systems that don't have such brain-dead notions. -- cgit v1.2.3