Re: XForms: Using app-defaults file to set default form values?

Kevin Carroll (kevincar@flash.net)
Sun, 21 Dec 1997 18:29:40 -0600

To subscribers of the xforms list from Kevin Carroll <kevincar@flash.net> :

T.C. Zhao wrote:
>
> To subscribers of the xforms list from "T.C. Zhao" <zhao@bloch.phys.uwm.edu> :
>
> On Dec 20, 2:19pm, Steve Lamont wrote:
>
> > You would have to read the app_defaults file and process it.
>
> I hate to contradict the mighty spl, but in this case, I think
> there are easier ways to handle the resource file.
>
> > static void set_startup_resources( void )
> >
> > {
> >
> > FILE *f = fopen( APP_DEFAULT_FILE, "r" );
> >
> > if ( f ) {
>
> > The above is a pretty stoneaxe approach but it did work in some
> > limited sense.
> >
> fl_initialize will read the resources from several places, including
> the standard app resource, so application does not have to open/read
> the file.
>
> Say, the resource for the input is inputN.content, you can
> do the following (content_holder is a char array that will hold the
> content):
>
> fl_initialize();
> fl_get_resource("inputN.content","InputN.Content",
> FL_STRING, default_val, content_holder, size);
>

Is it possible for "content_holder" to reference a form attribute such
as a button label or the text that resides in an input field? That is, I
would like to initialize form attributes from a resouce file. This
example seems to suggest that I must do something liket the following:

char content_holder[64];

fl_initialize();
fl_get_resource("inputN.content","InputN.Content",
FL_STRING, default_val, content_holder, size);

fl_set_input(obj,content_holder);

Hence, to initialize many input fields, I would need to declare many
"content_holder"'s.

> or you can lump every resource into a structure
>
> FL_resource res[] = {
> {"inputN.content","InputN.Content",FL_STRING, content_holder, 0, size},
> ...
> }
>
> then
> fl_initialize();
> fl_get_app_resource(res, Nres);
> /* create_all the forms */
> fl_set_input(input_object, content_holder);
>
> Of course, for this to work, the application default has to be
> in the standard place with standard name.
>
> _________________________________________________
> 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://bloch.phys.uwm.edu/xforms
> List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/

-- 
Kevin Carroll
Reltec

Phone (work): 972-501-3202 email (work): carrollk@riv.relteccorp.com email (home): kevincar@flash.net

_________________________________________________ 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://bloch.phys.uwm.edu/xforms List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/