Date: Thu, 16 Mar 1995 11:44:31 -0700 From: Gary Aitken <garya@boulder.openware.com> To: perry@pure.com, oi-users@freefall.cdrom.com Subject: Re: Getting the selection in an OI_abbr_menu Message-ID: <199503161844.LAA29316@garya.boulder.openware.com>
next in thread | raw e-mail | index | archive | help
> I'm having a bit of trouble finding out which is the selected cell in an > OI_abbr_menu. None of the members which relate to the currently selected > cell will admit to anything being selected. > > For example, the following code fragment always prints "num_selected -1" > although the menu obviously has a currently selected item: > > else if ( obj->is_derived_from( "OI_abbr_menu" ) ) > { > printf("\nSetOptionsFromFields: num_selected %d\n", > ((OI_menu *)obj)->num_selected() ); > } > > I've also tried iterating through the menu cells. I can print their names > but none of them will admit to being selected. > > I know that I could use a callback to record the changing selection and > assume that the last change was the one I wanted but I'm trying to keep > this simple and just use the vanilla OI objects. > > What's the trick? The OI_abbr_menu probably has an underlying menu type of OI_button_menu. OI_button_menu objects have cells which are selected only during the period while they are actually firing. The abbr_menu shows the current default cell, but the cell is not selected; it is simply the only one visible. Try asking for the default cell and see what you get. Or change the underlying menu type to some form of OI_excl_*_menu.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199503161844.LAA29316>