Help Renaming Tabs Using enterModalState()




I have been trying to make my tab names editable by following the advice given in this old thread:


It posts some code reposted here:

mEditLabel = new CTabLabelTextEditor(T("Tab Label")); 
mTabLabelBeingEdited = tabIndex;
mEditLabel->setBounds(theLabelXPos, Ypos, w, h);
mEditLabel->grabKeyboardFocus(); mEditLabel->enterModalState(); //make the editor modal, so clicks outside the box will delete it
mEditLabel->addActionListener(this); //listen to messages from the text editor

When mEditLabel becomes modal, it does not allow any other components on the screen to take mouse messages. I am not sure how his comment "//make the editor modal, so clicks outside the box will delete it" works with this bit of code. Can anyone give advice to allow clicks outside of the modal textbox to end the modal state, and remove mEditLabel from the display?







False alarm. All of the necessary code was presented. I did not see how it all fit togehter. When you override inputAttemptWhenModal in your textbox subclass, it is called when you click outside of the textbox. From here you can call exitModalState().