Re: XForms: problems with fl_get_choice_text

Bjoern Fuerst (fuerst@kph.uni-mainz.de)
Thu, 06 Nov 1997 09:08:50 +0100 (CET)

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

On 05-Nov-97 Steve Lamont wrote:

>> int redraw() !! nothing important changed here !!
>
>This should be
>
> int redraw( XEvent *event, void *data )
>
>but that shouldn't make any difference other than to possibly shut up
>some compiler warnings

OK, right, I corrected that. The function now looks as you said above.

>> fl_hide_object(MainForm->output_field);
>> fl_set_object_label(MainForm->output_field,output);
>> fl_show_object(MainForm->output_field);
>
>Why do the hide/show? Is this to prevent flicker? You should be
>using fl_freeze_form() if flicker is a problem, though in this case it
>should not be a problem -- the redraw should be quite fast.

Yes you're right again, I can omit these two lines. I thought that they would be
necessary to do a "clean" redrawing of the output-field. But it works fine
without them.

>> Touching a key on the active Window results in the mentioned
>> segmentation fault AND the last output of the printf was say
>
>> 2
>
>By "touching a key" what do you mean? Clicking on a button or
>pressing a keyboard key.

Touching a key, means a KEYBOARD KEY, anything else is no problem.
(three buttons and two choices on the form)

But do you have any idea where this pointer problem I wrote about
could be caused? In my opinion this looks like the "heart of the matter".
I modified my redraw... -function as follows.

int redraw(XEvent *event, void *data)
{
printf("pointer-value_start:%d\n",MainForm->dimension_choice);

sscanf((char *)datum(),"%*s %s %d %s %d",monat,&tag,time_string,&jahr);
sscanf((char *)time_string,"%d:%d:%d", &stunde_start, &minute_start, &sekunde\
_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_set_object_label(MainForm->output_field,output);

printf("pointer-value_end:%d\n",MainForm->dimension_choice);

return(0);
}

You see the two printf at the beginning and the end of the function.
Starting the program outputs something like this:

pointer-value_start:134631680
pointer-value_end:134631680
pointer-value_start:134631680
pointer-value_end:134631680
pointer-value_start:134631680
pointer-value_end:134631680
pointer-value_start:134631680
pointer-value_end:134631680 !! here I pressed a key on the keyboard !!
pointer-value_start:2

OK, that is the problem. The pointer just points to nowhere, somewhere or I
don't know where when I press a key.
-> fl_get_choice_text(MainForm->dimension_choice) goes to hell

I just have no idea what could cause that behaviour. I see no relation between
that pressed key and the pointer. "I feel so stupid!"

>In any case, it looks as if you're walking on something.
Sorry, don't know that expression. Walk on a bug or on bad programming style
or .....

>Where does the core dump occur? Can you do a traceback with a
>debugger (the gdb `where' command will do this).

Sorry I get no core dumped. Can I force the program to do so? Or what does it
mean when core is dumped or not? (fatal error <-> bad error)

Thank you

Bjoern

_________________________________________________
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/