Re: XForms: 0.86 API changes

Richard Kent (kent@hydra.dra.hmg.gb)
Fri, 13 Jun 1997 09:56:32 +0100

To subscribers of the xforms list from "Richard Kent" <kent@hydra.dra.hmg.gb> :

> I noticed that the API for fl_show_question() changed
> from (0.81):
>
> int fl_show_question(const char *s1, const char *s2, const char *s3)
>
> to (0.86):
>
> int fl_show_question(const char *message, int def)
>
> I must admit that the new API (that allows embedded newlines in
> the message) is much better than the old one, but I am disapointed
> to see that most similar functions still use the old method
> of passing 3 strings, like:
>
> void fl_show_alert(const char *s1,const char *s2,const char *s3,int c)
> int fl_show_choice(const char *s1,const char *s2,const char *s3, int
> numb,const char *b1,const char *b2,const char *b3, int def)
>
> Why not switch to the new method consistently ?
> (i.e. replace the 3 strings by one, with possible embedded new-lines).

No, no, no - please do NOT do that !! It was annoying enough having to convert
all my "question" boxes :) It is extremely handy having three separate strings
without having to manually tie them together. Let me demonstrate :-

You are loading a file but can't find it. At the moment I do :-

char *error = loadRoutine (filename); // loadRoutine returns an error string
fl_show_alert ("Warning - cannot load file",filename,error);

With one single string I have to do a lot more manually :-

char *error = loadRoutine (filename);
char tempBuffer [512];
sprintf (tempBuffer,"Warning - cannot load file\n%s\n%s",filename,error);
fl_show_alert (tempBuffer);

What we really need is a variably argumented function, fl_show_alert (...) so
you can have :-

fl_show_alert ("Warning");
fl_show_alert ("Warning\n",filename," not found\n",error);

Either that or user a printf style function :-

fl_show_alert ("Warning\n%s not found\n%s",filename,error);

(and similar for other functions)

In the worst case scenario please leave in all the old three stringed versions.
I currently have a function fl_show_question_old which manually ties together
the three strings to simulate the old behaviour. This could be done for the
others as well and left in the forms library (and documented). Just append _old
to them !!

Also I agree that changes in the API should be flagged up more. I noticed that
the fl_drw_text (and related functions) swapped around their style and size
parameters to be more consistent with other functions. This was VERY annonying
as it still compiled without warning (both are integer constants) but crashed
out with X errors at run-time. Took a while to work out what was going wrong as
I am not too familiar with specific X error codes !!

Cheers,

TicH

------------------------------------------------------------------------
| Name - Richard Kent |
| EMail - kent@hydra.dra.hmg.gb |
| Plan - All work and no play.....hi ho, hi ho |
------------------------------------------------------------------------

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