XForms: problems with fl_get_choice_text

Bjoern Fuerst (fuerst@kph.uni-mainz.de)
Wed, 05 Nov 1997 11:54:43 +0100 (CET)

To subscribers of the xforms list from Bjoern Fuerst <fuerst@kph.uni-mainz.de> :

hello,

i've got a problem with the xforms-function "fl_get_choice_text"!

I wrote a small program that has just one output-box (NORMAL_TEXT) and two
choice-fields (FL_NORMAL_CHOICE2). It should work as a timer, counting down
from one date and time to another. So the contents of the output box depends
on what you choose in the choice boxes, i.e. you can change events and
dimensions.

So, that's it and it works fine. I can change dimension, e.g. from seconds to
weeks and the output changes accordingly!

BUT

If I press a key on the activated Window, I get a segmentation-fault in

fl_get_choice_text

at least, that is what gdb says.

I hope this is not just a dumb error of mine, but I just can't figure it out,
because I don't understand that everything is fine until I touch the keyboard.
I'm not a crack in C and I'm hacking with X-Forms only for about one week, so
don't be to hard with me if it's my fault!

Here is the piece of code that "causes?" the error, or at least the only part
that uses fl_get_choice_text! It is called every second to update the output-
field.

void redraw()
{
sscanf((char *)datum(),"%*s %s %d %s %d",monat,&tag,time_string,&jahr);
sscanf((char *)time_string,"%d:%d:%d", &stunde_start, &minute_start, &sekund
e_start);
monat_int=make_month(monat);

calculate(julian(tag,monat_int,jahr),
julian(17,12,1997),
stunde_start, minute_start, sekunde_start,
11, 25, 00,
(char *)fl_get_choice_text(MainForm->dimension_choice),
(char *)output);

fl_hide_object(MainForm->output_field);
fl_set_object_label(MainForm->output_field,output);
fl_show_object(MainForm->output_field);
alarm(1);
signal(SIGALRM, redraw);
}

So, perhaps someone has got an idea, what the problem is.

Thank you for any comment

Bjoern

P.S.
some information on my system

xforms v0.86
gcc v2.7.2.1
running on a 486 with linux "elf"

P.P.S.
I also tried to get around the problem in changing from

(char *)fl_get_choice_text(MainForm->dimension_choice)

to

(char *)fl_get_choice_item_text(MainForm->dimension_choice,fl_get_choice(MainFor
m->dimension_choice))

but then gdb reports a segmentation fault error in fl_get_choice!!!!

E-Mail: Bjoern Fuerst <fuerst@kph.uni-mainz.de>
Date: 05-Nov-97
Time: 11:54:43
-------------------------------------------------------------------------------
Bjoern Fuerst Proud Member of the WWW-A2-Team
A2 Collaboration Phone: ++49/6131/39-5899
Institut fuer Kernphysik Fax: ++49/6131/39-2964
Johannes Gutenberg Universitaet WWW: http://www.kph.uni-mainz.de/A2
Johann-Joachim-Becher Weg 45
D-55099 Mainz
Germany
-------------------------------------------------------------------------------
"Nice joke Scotty - now beam up my clothes"
-------------------------------------------------------------------------------
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/