xforms-development
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XForms] Update: menu item return value


From: esserlo
Subject: [XForms] Update: menu item return value
Date: Wed, 12 Mar 2014 11:39:25 -0400
User-agent: SquirrelMail/1.4.19

Hi,

   I am able to 'fix' this by replacing in menu.c line ~826 with

return ( (int) sp->mval[sp->val] );

(Instead of return ( val_to_index (ob, sp->val));

However, I don't know whether this breaks anything else. I also noticed that
there are functions like isdigit or isspace which expect (int) as argument but
the typecasting is to (char). This may be okay as the compiler figures this
out probably....

Also, a minor issue is that in forms.h there are a number of enumerations that
have a , following the last argument. My compiler complains about this and
about functions that 'are' not prototypes. Putting (void) into the prototype
which was declared as (  ) fixed the problem(s).

Let me know whether my fix above is 'safe'.

Thanks,

   Lothar


> Hi,
>
>   it's been a while since I worked with xforms intensively. However I still
> use a program that uses Xforms 0.86 (or so from memory). Since there were a
> few minor issues, I decided to compile the latest xforms-1.2.3 and it worked
> like a charm and linked right away to my program.
>
> However, xforms 1.2.3 has a problem. Menu entries are supposed to return their
> position from 1 - to N with N being the last number (fl_get_menu(ob)). But the
> programmer has the option to return a different value in my case the quit
> button returns 99. (This is done with Quit%x99). It now returns -1. After some
> experimenting I found out that Quit may return any value as long as it is less
> than or equal the number of entries so the recognition of %x is not broken.
>
> In the end what appears to be broken is the function val_to_index in menu.c.
> Or maybe it is a bit upstream... what needs to be returned is the value stored
> for the ith menu entry ... instead of return i it should at some point return
> (sp->mval[val]) ... something like an index (menu item position)-to-numerical
> value stored for it.
>
> If this description is unclear, I could come up with a demo. I used boxtype.c
> in demos to try this out (somewhat easier than my bulky program). Just add a
> %x99 to item5 and printout the value ... you will always get -1.
>
> Cheers,
>
>   Lothar
>
>
>
>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]