XForms: X Error Messages (detailed)

R. Cook (rcook79@yahoo.com)
Tue, 26 Oct 1999 19:23:33 -0700 (PDT)

# To subscribers of the xforms list from "R. Cook" <rcook79@yahoo.com> :

Hi,

I have a form with a tabbed Folder with two tabs. In
each tab I have several input fields, some are
integer, and some are of type float. I'm having
problems with just one input field (float).

I can enter values in all the fields and change their
values all the times I want to. But, after I press a
button to calculate a couple of things, and the
calculations are done, if I try to change the value of
that specific input field then I get the following
messages on my xterm (and my program exits...):
=======================================================
X Error of failed request: BadDrawable (invalid
Pixmap or Window parameter)
Major opcode of failed request: 70
(X_PolyFillRectangle)
Resource id in failed request: 0x5
Serial number of failed request: 4903
Current serial number in output stream: 4944
X Error of failed request: BadDrawable (invalid
Pixmap or Window parameter)
Major opcode of failed request: 70
(X_PolyFillRectangle)
Resource id in failed request: 0x5
Serial number of failed request: 4905
Current serial number in output stream: 4948
=======================================================

Inside the tabbed folder, there is also a slider bar,
which I'm using as a progress bar. The value of the
slider bar is being changed inside the calculating
function, after it is finished, it is set to a new
color. The slider bar's bounds are from 0 to 100. This
bar has no callback function assigned, and it is
deactivated (for the user).

There is also something weird in all of this, if I
enter the values into the float input field like this:
123456.7890 there is no problem at all. The problem
presents itself when I enter the values like this:
1.2345e+02, as far as I understand this should'nt be a
problem.

======================= CODE
==========================
/* This is the callback function for the button that
initiates the calculations. I'm using the 'u_ldata'
field of the object for the data variables I'm
calculating (although I'm not sure if that is the
purpose of this field). After the calculations are
done, ANOTHER input field is updated, showing the
result.
*/

void calculateCb(FL_OBJECT *obj, long data)
{
FD_main *fdm = obj->form->fdui;
dataVar *dV;
char buffer[80];

dV = (dataVar*) (obj->u_ldata);

/* Initiate Slider to zero */
fl_set_slider_value(fdm->progress,0.00);

/* Call the function to calculate, passing the
progress
bar object as a parameter.
*/
calculate(dV,fdm->progress);

/* Update the result input field*/
sprintf(buffer,"%.2f",dV->value);
fl_set_input(fdm->var1,buffer);
}

=======================================================

/* function 'calculate', showing the part where the
slider bar is being modified....
*/
void calculate(dataVar *dV, FL_OBJECT *progress)
{
float currentProgress = 0.0;
float deltaProgress = 0.01;

/* Some code */

do {

/* some code */

currentProgress += deltaProgress;
fl_set_slider_value(progress,currentProgress);

} while (currentProgress < 100.0);
}

=======================================================

/* Callback function for the input field with the
'weird' problem...The object is set to return ALWAYS.

*/

void inputVar2Cb(FL_OBJECT *obj, long data)
{
double *var2;

var2 = (double*)(obj->u_ldata);

*var2 = atof(fl_get_input(obj));
}

=======================================================

I really hope that somebody could help me out, if you
should need anything else just ask.

Gratefully,
R. Cook

=====

__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com
_________________________________________________
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://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuhs.mil/mailserv/list-archives/