Hot Door CORE Forum

Full Version: scrambled values in ComboBoxes
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
When entering some combinations of numbers with fractions into a combobox field, some numbers are accepted and others aren't. It happens in all comboboxes. At first I thought there just wasn't enough space for all digits so I tried it in even smaller fields and the behavior was consistent. For example, enter "4 1/3" and the value will be accepted, but "4 1/4" turns into "44" and with decimals "4.4" becomes "24" but "3.33333" is accepted. This change happens even before the field calls the callback, which currently has no code--the callback receives the altered text, not the value as entered. Here's how I define my comboboxes (v is the vector):

Code:
this->__dPanelTCtrBox = hdi::core::ComboBox::ComboBoxWithValue( hdi::core::Point(154, marginHeight+36), 72.0, v, "2.0");
    this>__dPanelTCtrBox.setAlignment(hdi::core::ComboBox::RightAlignment);
    this->__dPanelTCtrBox.setValueChangedCallback(HDI_CORE_CALLBACK(panel::Plugin, this, __pnlTCtrChangedCB));
    this->__docPanel.addWidget(this->__dPanelTCtrBox);

The menu portion works perfectly. Any ideas what might be happening?
After spending way too much time struggling with this, I moved on to other sections of the plugin code when it suddenly hit me:

I have KeypressMonitors set up and, sure enough, the numbers it had trouble with were the ones I was monitoring. I revised the code so that the keypress monitors are added at MouseDown and removed at MouseUp, and the comboboxes behaved normally again. I hope this is the correct time and way to do this.
Sounds like you got it pretty much figured out. We register keypress monitors in our plugins all the time, and mouse down/up or tool select/deselect is a very reasonable time to do so (depending on the key being monitored).