bug-ncurses
[Top][All Lists]
Advanced

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

Re: About the menu's toprow and menu's curitem


From: Thomas Dickey
Subject: Re: About the menu's toprow and menu's curitem
Date: Sat, 22 Mar 2014 17:29:45 -0400
User-agent: Mutt/1.5.20 (2009-06-14)

On Tue, Mar 18, 2014 at 06:20:32PM +0800, 王德亮 wrote:
> Due to my poor English, I think you misunderstand me.
> 
> >There is no standard way to do this:  combining the two was not in the
> >SVr4 menu library.  ncurses actually has a private function
> >_nc_New_TopRow_and_CurrentItem which appears to do this (it is of course
> >not recommended to use private functions - doing that is always at your
> >own risk...).
> >
> I don't think the internal function _nc_New_TopRow_and_CurrentItem can do the 
> job,
> as the debug message show in the picture 2 that I offered, the 
> _nc_New_TopRow_and_CurrentItem has been token effect,
> because the menu->toprow and menu->curitem has been changed right, but the 
> post result is not what I wanted.
> 
> 
> What I wonder is: 
> when I set_current_item(my_menu, my_items[3]); it works wonderful;
> but when I set_current_item(my_menu, my_items[8]);, it's not worked. 
> so I think the macro Adjust_Current_Item(menu,row,item) should be:
> #define Adjust_Current_Item(menu,row,item) \
>   { if ((item)->y < row) \
>       row = (item)->y;\
>     if ( (item)->y >= (row + (menu)->arows) )\
>       row = ( (item)->y < ((menu)->rows - (menu)->arows) ) ? \   /* repleaced 
> with "row = ( (item)->y < ((menu)->rows -row) )" */
>             (item)->y : (menu)->rows - (menu)->arows;\
>     _nc_New_TopRow_and_CurrentItem(menu,row,item); }

I see what you are asking about, but with the sample program provided,
I get the same message from posting with/without the suggested change:

ret: 0, top: 6, cur_idx: 8, cur->name: Choice 9

(I ran this before/after with 5.9-release and current code)

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

Attachment: ncurses-lnwdl.c
Description: Text Data

Attachment: signature.asc
Description: Digital signature


reply via email to

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