Exemplo n.º 1
0
/*************************************************************************
	Handler for mouse button down events in editbox	
*************************************************************************/
bool Combobox::editbox_MouseDownHandler(const EventArgs& e)
{
	// only interested in left button
	if (((const MouseEventArgs&)e).button == LeftButton)
	{
		// if edit box is read-only, show list
		if (d_editbox->isReadOnly())
		{
			showDropList();

			// if there is an item with the same text as the edit box, pre-select it
			ListboxItem* item = d_droplist->findItemWithText(d_editbox->getText(), NULL);

			if (item != NULL)
			{
				d_droplist->setItemSelectState(item, true);
				d_droplist->ensureItemIsVisible(item);
			}
			// no matching item, so select nothing
			else
			{
				d_droplist->clearAllSelections();
			}

			return true;
		}
	}

	return false;
}
Exemplo n.º 2
0
/*************************************************************************
	Handler function for button clicks.
*************************************************************************/
bool Combobox::button_PressHandler(const EventArgs&)
{
    selectListItemWithEditboxText();
    showDropList();

	return true;
}
Exemplo n.º 3
0
/*************************************************************************
	Handler function for button clicks.
*************************************************************************/
bool Combobox::button_PressHandler(const EventArgs& e)
{
	showDropList();

	// if there is an item with the same text as the edit box, pre-select it
	ListboxItem* item = d_droplist->findItemWithText(d_editbox->getText(), NULL);

	if (item != NULL)
	{
		d_droplist->setItemSelectState(item, true);
		d_droplist->ensureItemIsVisible(item);
	}
	// no matching item, so select nothing
	else
	{
		d_droplist->clearAllSelections();
	}

	return true;
}