Re: Free object in fdesign?

Steve Lamont (spl@szechuan.ucsd.edu)
Thu, 24 Apr 97 06:16:33 PDT

To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> I'm writing an application that uses (as well as other things)
> a free object. The trouble is that fdesign doesn't have one
> of these in its object list and its very awkward having to
> constantly edit the files generated from fdesign to add the
> free object declaration (in the struct in the .h file) and
> the call to fl_add_free etc (to the create_form function in
> the .c file).

Then don't. :-)

You don't have to lump all of object creation calls into the fdesign
created file (though, I agree, it's more convenient to do so). You
can make your call to the fdesign supplied routine as normal and then
use fl_addto_form() to add your free object, remembering, of course,
to close the form again with fl_end_form().

Of course this does not put the object into the FD_* structure but it
does get it built.

A hack I've used to get around this is to create a placeholder object
in the form definition -- a Box or Frame object will work just fine.
Then use the fdesign supplied function to create the form. Before
displaying the form, create your new object with the appropriate
calls, free the placeholder object using fl_free_object(), and then
assign your new object into the just freed structure member.

Refer to the manual for the details.

You can even use the geometry from the old object to specify the
geometry of your new object by interrogating the appropriate structure
members (before you destroy the old object, of course).

I don't know if this makes life any simpler (computers *never* make
life any simpler) but it will get the job done without having to muck
about hand editing the fdesign headers and .c files.

I do agree that the Free object ought to be somehow instantiated in
fdesign though exactly how I'm not sure since it's a little strange.

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/xforms-archive/