Re: XForms: how does fl_show_question() do it ?

Gerald Gryschuk (ggryschuk@scf.sk.ca)
Thu, 09 Jul 1998 12:07:42 -0600

# To subscribers of the xforms list from Gerald Gryschuk <ggryschuk@scf.sk.ca> :

Steve Lamont wrote:
>
> In the case we're discussing -- emulating the Goodies -- the "do it"
> or "don't do it" buttons have no callbacks -- they just cause
> fl_do_forms() to return to its caller, which is what you want, in this
> case.

Well this seems like a good place to jump in. I'm very brand new to
Xforms but being a newbie has never stopped me from having hutzpah. One
of the first things I ran across when using xforms was that I wanted to
create a modal dialog box and there didn't seem to be a "simple" way.
Simple here is of course relative, once I figured it out it wasn't all
that hard but the solution left something to be desired in that I always
had to "know" that I was going to use the form as a modal dialog and not
bind callbacks to the "return" buttons. So I designed what I think is a
"better" solution(others may disagree and in fact find my solution very
naive). I created a function which has the following
prototype,
int fl_show_modal(FL_FORM*,const char* title,int place,int border,int
type)

I believe it should be able to take any FL_FORM definition and make it
into a "modal" form. It does this by adding 2 buttons to the form, one
indicating "success" the other "failure",
if the user pushes the "success" button the function returns 1, if the
"failure" button it returns 0. Of course it uses the "standard" methods
already discussed in this list to loop until one of the "new" buttons is
pressed. The buttons are added to the form by actually increasing the
size of the form and adding the buttons at the bottom. The buttons can
take standard labels like "Done","Ok","Cancel" etc. or through the use
of another function,

void fl_set_modal_label(const char* title,int type);

the label can be changed to anything. Unfortunately right now I'm using
hardcoded sizes for the buttons so if the label that is set using this
function is "too" large it looks crappy.

Anyway, it seems to be working on my system(s) (Linux 4.2 and 5.0) with
very limited testing, if anyone would like to give this a whirl and test
it for me I'ld be very appreciative. If anyone wants it they can e-mail
me and I'll send back the source(it's very short).

-- 
Gerald Gryschuk(ggryschuk@scf.sk.ca)
Programmer Analyst
Saskatoon Cancer Centre
((306)655-2746)
_________________________________________________
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/