Hot Door CORE Forum
scrambled values in ComboBoxes - Printable Version

+- Hot Door CORE Forum (http://hotdoorcore.com/forum)
+-- Forum: All forums (http://hotdoorcore.com/forum/forumdisplay.php?fid=1)
+--- Forum: Getting started (http://hotdoorcore.com/forum/forumdisplay.php?fid=6)
+--- Thread: scrambled values in ComboBoxes (/showthread.php?tid=83)



scrambled values in ComboBoxes - Rick Johnson - 07-09-2016

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?


RE: scrambled values in ComboBoxes - Rick Johnson - 07-09-2016

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.


RE: scrambled values in ComboBoxes - garrett - 07-14-2016

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).