bug-ncurses
[Top][All Lists]
Advanced

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

RE: Menu & set_current_item


From: Jürgen Pfeifer
Subject: RE: Menu & set_current_item
Date: Thu, 14 Jun 2001 00:33:01 +0200

> 
> I don't know if this is a bug but if that doesn't,
> could you explain me how to do this : 
> 
> I've got a menu with items. I've got two items not
> selectable. When the cursor is on this item I want to
> go to the next item. So I use set_current
> (set_current_item), but that doesn't work. If I put
> the set_current in the constructor of the menu, that's
> working.
> 
> I join a short code for sample.
> 
If you would handle exceptions in your code then you would find that you
got an E_BAD_STATE from the set_current() call. That's because
set_current_item() is not allowed while you are in a driver call. All
the On_..._Init() and On_..._Termination() virtuals are driver calls
(that means are called while the menu system is already in the driver
routine). Recursive driver calls are simply forbidden because otherwise
we would have to maintain a stack the item states.

A possible approach to solve your problem is to overload the
On_Not_Selectable() virtual in your child class and in this routine you
may send yourself the request REQ_NEXT_ITEM (using the protected
driver() method).

Cheers
Jürgen



reply via email to

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