Hi,
I send a mail to this list 2 a days ago, about a problem with the file
Selector...
>another problem apears while using the fileselector.
>I have to double-click about 10 times on the "D.." line to make it
>changing directory...(but only the first time i use the fileselector,
>after this, it seems to work fine.)
In fact, the problem seems to come from a "fl_timer" object (i
reproduced this strange behaviour only under linux)
I have modified the file fbrowse.c in the DEMO directory to test it ...
I attached it with this mail (to test the fileselector, just click on
the "load" button and try to change the current directory...). It looks
like a bug.
cheers,
Yann
/*
* This demo shows the use of a browser and a file selector.
* Good browser/scrollbar test
*
* This file is part of xforms package
* T.C. Zhao and M. Overmars
*
*/
#include <stdio.h>
#include <stdlib.h>
#include "forms.h"
typedef struct {
FL_FORM *form;
void *vdata;
char *cdata;
long ldata;
FL_OBJECT *br;
FL_OBJECT *fl_timer;
} FD_form;
void load_file(FL_OBJECT *ob, long arg)
{
const char *fname;
FD_form *fdui = ob->form->fdui;
if((fname = fl_show_file_selector("File To Load","","*","")))
{
if (! fl_load_browser(fdui->br,fname))
fl_add_browser_line(fdui->br,"NO SUCH FILE!");
}
}
void set_size(FL_OBJECT *ob, long arg)
{
FD_form *fdui = ob->form->fdui;
fl_set_browser_fontsize(fdui->br,(int)arg);
}
void exit_program(FL_OBJECT *ob, long data)
{
exit(0);
}
void hide_show(FL_OBJECT *ob, long data)
{
FD_form *fdui = ob->form->fdui;
if(fdui->br->visible)
fl_hide_object(fdui->br);
else
fl_show_object(fdui->br);
}
FD_form * create_form(void)
{
FL_OBJECT *obj;
FL_Coord x = 20, dx = 80, dy = 28;
FD_form *fdui = fl_calloc(1, sizeof(*fdui));
fdui->form = fl_bgn_form(FL_NO_BOX,590,610);
obj = fl_add_box(FL_UP_BOX,0,0,590,610,"");
fdui->br = obj = fl_add_browser(FL_NORMAL_BROWSER,20,20,550,530,"");
/* fl_set_object_boxtype(obj,FL_EMBOSSED_BOX); */
obj = fl_add_button(FL_NORMAL_BUTTON,x,565,dx-5,dy,"Load");
fl_set_object_callback(obj,load_file,0);
x += dx ;
obj = fl_add_lightbutton(FL_RADIO_BUTTON,x,565,dx,dy,"Tiny");
fl_set_object_callback(obj,set_size,FL_TINY_SIZE);
x += dx;
obj = fl_add_lightbutton(FL_RADIO_BUTTON,x ,565,dx,dy,"Small");
fl_set_object_callback(obj,set_size,FL_SMALL_SIZE);
fl_set_button(obj, FL_SMALL_SIZE == FL_BROWSER_FONTSIZE);
x += dx;
obj = fl_add_lightbutton(FL_RADIO_BUTTON,x ,565,dx,dy,"Normal");
fl_set_object_callback(obj,set_size,FL_NORMAL_SIZE);
fl_set_button(obj, FL_NORMAL_SIZE == FL_BROWSER_FONTSIZE);
x += dx;
obj = fl_add_lightbutton(FL_RADIO_BUTTON,x ,565,dx,dy,"Large");
fl_set_object_callback(obj,set_size,FL_LARGE_SIZE);
x += dx + 4;
obj = fl_add_button(FL_NORMAL_BUTTON,x,565,dx,dy,"Hide/Show");
fl_set_object_callback(obj, hide_show, 0);
x += dx + 5;
obj = fl_add_button(FL_NORMAL_BUTTON,x,565,60,dy,"Exit");
fl_set_object_callback(obj, exit_program, 0);
fdui->fl_timer=fl_add_timer(FL_HIDDEN_TIMER, 0, 0,1, 1, "");
fl_end_form();
fl_adjust_form_size(fdui->form);
fdui->form->fdui = fdui;
return fdui;
}
int
main(int argc, char *argv[])
{
FD_form *fdui;
fl_initialize(&argc, argv, "FormDemo", 0, 0);
fdui = create_form();
fl_clear_browser(fdui->br);
fl_add_browser_line(fdui->br,"LOAD A FILE.");
fl_set_browser_fontstyle(fdui->br,FL_FIXED_STYLE);
fl_show_form(fdui->form,FL_PLACE_FREE,FL_FULLBORDER,"Browser");
fl_do_forms();
fl_hide_form(fdui->form);
fl_free_form(fdui->form);
fl_finish();
return 0;
}
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuhs.mil or see
http://bob.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://world.std.com/~xforms
List Archive: http://bob.usuhs.mil/mailserv/list-archives/
This archive was generated by hypermail 2b29 : Mon Sep 11 2000 - 09:17:08 EDT