fl_message function

This example shows how to fl_message function.

 1 #pragma package ".."
 2 
 3 #include "chfltk.h"
 4 #include <stdio.h>
 5 #include <stdlib.h>
 6 
 7 void message_cb(Fl_Widget *g, void *v) {
 8   int *counter = (int*)v;
 9   (*counter)++;
10   const char *message = "Called %d times";
11   fl_message(message, *counter);
12 }
13 
14 int main(int argc, char *argv[])
15 {
16   Fl_Window *window = new Fl_Window(300, 180);
17   Fl_Button *countbutton = new Fl_Button(20, 40, 200, 50, "Message Button");
18   countbutton->box(FL_UP_BOX);
19   int counter = 0;
20   countbutton->callback((ChFl_Callback)message_cb, (void*)&counter);
21   window->end();
22   window->show(argc, argv);
23   Fl::run();
24   exit(1);
25   return 0;
26 }

Copyright 2006 Roman Putanowicz

Email: putanowr at twins.pk.edu.pl

Last Modified: Thu, 29 Jun 2006 18:01:53 CEST

Made with PubTal 3.1.3