Selecting files

This example shows how to use fl_file_chooser function.

 1 #pragma package ".."
 2 
 3 #include "chfltk.h"
 4 #include <stdio.h>
 5 #include <stdlib.h>
 6 
 7 void select_cb(Fl_Widget *g, void *v) {
 8   const char *name;
 9   name = fl_file_chooser("Select file", "*.i", "ala.i");
10 }
11 
12 int main(int argc, char *argv[])
13 {
14   Fl_Window *window = new Fl_Window(300, 180);
15   Fl_Button *box = new Fl_Button(20, 40, 260, 100, "Select file");
16   box->box(FL_UP_BOX);
17   box->callback((ChFl_Callback)select_cb, (void*)0);
18   box->labelsize((uchar)36);
19   box->labelfont((uchar)(FL_BOLD+FL_ITALIC));
20   window->end();
21   window->show(argc, argv);
22   Fl::run();
23   exit(1);
24   return 0;
25 }

Copyright 2006 Roman Putanowicz

Email: putanowr at twins.pk.edu.pl

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

Made with PubTal 3.1.3