From owner-oi-users Thu Mar 16 10:44:51 1995 Return-Path: oi-users-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id KAA20934 for oi-users-outgoing; Thu, 16 Mar 1995 10:44:51 -0800 Received: from marvin.boulder.openware.com (marvin.boulder.openware.com [192.245.99.138]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id KAA20915 for ; Thu, 16 Mar 1995 10:44:46 -0800 Received: from garya.boulder.openware.com (garya.boulder.openware.com [198.135.223.34]) by marvin.boulder.openware.com (8.6.9/8.6.9) with ESMTP id LAA25541; Thu, 16 Mar 1995 11:42:21 -0700 Received: (from garya@localhost) by garya.boulder.openware.com (8.6.9/8.6.9) id LAA29316; Thu, 16 Mar 1995 11:44:31 -0700 Date: Thu, 16 Mar 1995 11:44:31 -0700 From: Gary Aitken Message-Id: <199503161844.LAA29316@garya.boulder.openware.com> To: perry@pure.com, oi-users@freefall.cdrom.com Subject: Re: Getting the selection in an OI_abbr_menu Sender: oi-users-owner@FreeBSD.org Precedence: bulk > 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.