static void DoRemoveTest(void)
	// Called in response to a click of the "Remove" button. 
{
	OSStatus	err;
	CFIndex 	itemCount;
	CFIndex 	itemIndex;
	Boolean		found;
	
	// Find the index of the selected item in the data browser 
	// control.
	
	itemCount = CFArrayGetCount(gItems);
	itemIndex = 0;
	found = false;
	while ( (itemIndex < itemCount) && ! found ) {
		found = IsDataBrowserItemSelected(gDataControl, (DataBrowserItemID) itemIndex + 1);;
		
		if ( ! found ) {
			itemIndex += 1;
		}
	}
	
	// Use LIAE to remove it.
	
	if (found) {
		err = LIAERemove(itemIndex);
	} else {
		// It's not an error to have no selection because we don't dynamically 
		// enable/disable the Remove button.
		err = noErr;
	}
	
	if (err == noErr) {
		DoRefresh();
	} else {
		DisplayError(err);
	}	
}
Пример #2
0
bool wxMacDataBrowserControl::IsItemSelected( DataBrowserItemID item ) const
{
    return IsDataBrowserItemSelected( m_controlRef, item );
}