bug-ncurses
[Top][All Lists]
Advanced

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

Re: field_opts_off() returns E_CURRENT


From: Thomas Dickey
Subject: Re: field_opts_off() returns E_CURRENT
Date: Sun, 29 Mar 2009 11:04:03 -0400
User-agent: Mutt/1.5.18 (2008-05-17)

On Fri, Mar 27, 2009 at 05:50:55PM -0600, TW wrote:
>   Here's the code that I have:
> 
>       /* Initialize the fields */
>       /* num rows, num cols, start row, start col, off-screen rows, num 
> buffers */
>       for(i=0, j=0; i<NFIELDS-1; i=i+2, j++) {
>           field[i] = new_field(1, CAPTION_WIDTH, FORM_STARTY+j, FORM_STARTX, 
> 0, 0);
>           field[i+1] = new_field(1, FORM_WIDTH, FORM_STARTY+j, 
> CAPTION_WIDTH+3, 0, 0);
>       }
>       field[NFIELDS-1] = NULL;
>   
>           <...create and post form and refresh...>
>   <...snip...>
> 
>       /* Set field options */
>       for(i=0, j=0; i<NFIELDS-1; i=i+2, j++) {
>           /* Set row label buffer */
>           set_field_buffer(field[i], 0, form_data[j].label);
>   
>           /* Set field options for label */
>       ==> RETURNS E_CURRENT
>           result = field_opts_off(field[i], O_ACTIVE | O_EDIT);
...
>       refresh();
>       curs_set(1);
> 
>   <...snip...>
> }
> 
> The set_field_buffer function returns E_CURRENT for field[0], though the
> field is in memory.  The other fields return E_OK.  (1) Why is only field[0]
> not getting O_ACTIVE and O_EDIT deactivated.  (2) I know that E_CURRENT is
> explained as "the field is the active one on the form." I don't understand it
> in the context of this problem I'm having.  If it's the current one,
> shouldn't the function work as planned?

Well... it's documented (and is done this way for compatibility with the
AT&T code).  I have a hunch that it was done that way in the original code
to keep from changing the field while it's being edited.  Bear in mind
that validation happens when you leave the field (and it's no longer current).

-- 
Thomas E. Dickey <address@hidden>
http://invisible-island.net
ftp://invisible-island.net

Attachment: signature.asc
Description: Digital signature


reply via email to

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