Re: XForms: Accessing objects in a form

Harikumar (hari@thor.i-connect.net)
Wed, 18 Jun 1997 17:09:01 -0700 (PDT)

To subscribers of the xforms list from Harikumar <hari@thor.i-connect.net> :

On 18-Jun-97 spl@szechuan.ucsd.edu wrote:
>>To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :
>
>> How we access the objects inside a form.
>>
>> To be more precise, I want to set the contents of a
>> MultilineEdit object while pressing a button object.
>
>Any named object (that is, any object given a name using the
>Attributes panel of fdesign) can be accessed by referring to it via
>the FD_whatever data structure generated by the create function
>generated by fdesign. You can access this structure from within a
>callback as follows:
>
> void my_callback( FL_OBJECT *ob, long data )
>
> {
>
> FD_whatever *whatever = ( FD_whatever *) ob->form->fdui;
>
> fl_set_object_stuff( whatever->some_other_object,
> [... parameters ...] );
>
> }
>
>This way you don't have to fish through the list of objects in the
>form.
>
>The objects in the form are created in the order found in the form's
>.fd file. This is sort of the order in which they were added to the
>form. This gets altered if you create groups, etc. If you're
>relatively careful in hand editing the .fd file you can change the
>creation order but there's generally no point in doing so if you just
>name the objects.
>
>The only time I've ever had to chain through the object list in the
>form is to alter things in a group. Then I'd do something like
>
> void my_callback( FL_OBJECT *ob, long data )
>
> {
>
> FD_whatever *whatever = ( FD_whatever *) ob->form->fdui;
> FL_OBJECT *obj = whatever->some_group->next;
>
> while ( obj->type != FL_END_GROUP ) {
>
> do_whatever( obj );
> obj = obj->next;
>
> }
>
> }
>
> spl
>_________________________________________________
>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/

----------------------------------
E-Mail: Harikumar <hari@thor.i-connect.net>
Date: 06/18/97
Time: 17:09:05

This message was sent by XF-Mail
----------------------------------
Hi,

Thanks for the timely suggestion. It was most helpful.

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 *theFduiPtr = (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 could work around when I have an explicit pointer to the Multiline
Object and pass it as the long data of the callback and use that pointer.

In this case I need to modify the fdesign created .c file. Actually
I don't want to do that so that I can modify and save my forms at any
time of the development.

What will be another work around?

Thanks in advance.

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