I have a combobox in my plugin which includes items with long names. I want to truncate the text after user has chosen an item. In other words, when the user selects an item from the popup menu I want to display the truncated version of that text in the comobox's textbox. I have a lookandfeel class and implemented "drawComboBox" function in it. At the end of this function I added the truncating logic. The problem is whenever I call setText on the combobox it will reset the selectedID to 0. Based on juce_Combobox.h I already know why this is happening:
/** Sets the contents of the combo-box's text field.
The text passed-in will be set as the current text regardless of whether
it is one of the items in the list. If the current text isn't one of the
items, then getSelectedId() will return -1, otherwise it wil return
the approriate ID.
@param newText the text to select
@param notification determines the type of change notification that will
be sent to listeners if the text changes
void setText (const String& newText,
NotificationType notification = sendNotificationAsync);
my question is, is it at all possible to do what I want to do? If yes, how?