Re: XForms: Accessing objects in a form

Frank Stefani (EAD-Frank.Stefani@t-online.de)
Thu, 19 Jun 1997 11:17:23 +0200

To subscribers of the xforms list from EAD-Frank.Stefani@t-online.de (Frank Stefani) :

Harikumar wrote:

> But when I try to set the input of a MultilineEdit object
> inside a callback of a button object, I end up with Segmentation
> fault.
>
> My call back is
>
> void Mycallback (FL_OBJECT *ob, long user_data)
> {
>
> FD_whatever = (FD_whatever *)ob->form->fdui ;
>
> fl_set_input(theFduiPtr->meobj,"") ;
> }
>
> meobj is the name of the Multiline edit object and Mycallback() is the
> callback attribute of the button object.

I suggest you should declare "theFduiPtr" as a global variable
in your source file which has "main()" in it:

FD_whatever *theFduiPtr;

Just this short declaration, NOT
"FD_whatever *theFduiPtr = (FD_whatever *)ob->form->fdui ;".
Then you initialize the pointer with the appropriate function

theFduiPtr = create_form_whatever();

Now, in your callback file you refer to it as external:

extern FD_whatever *theFduiPtr;

and in your callback function you can easily access it with

void Mycallback (FL_OBJECT *ob, long user_data)
{
fl_set_input(theFduiPtr->meobj,"");
}

Hope this helps (it does for me ;-)

Frank.

-- 
---------------------------------------------------------------
     _/_/_/_/     _/_/     _/_/_/    EAD-Systeme GmbH
    _/          _/  _/    _/    _/   Nachfeldstr. 4
   _/_/_/     _/    _/   _/     _/   D-82490 Farchant, Germany
  _/        _/_/_/_/_/  _/     _/    Phone: +49 8821 9623-0
 _/_/_/_/ _/        _/ _/_/_/_/      Fax: +49 8821 9623-20
---------------------------------------------------------------
Email: EAD-Frank.Stefani@t-online.de
---------------------------------------------------------------

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