About   |   Getting Started   |   Downloads   |   Documentation   |   Forum


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
scrambled values in ComboBoxes
07-09-2016, 01:05 PM
Post: #1
scrambled values in ComboBoxes
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?
Find all posts by this user
Quote this message in a reply
07-09-2016, 03:04 PM
Post: #2
RE: scrambled values in ComboBoxes
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.
Find all posts by this user
Quote this message in a reply
07-14-2016, 02:33 PM
Post: #3
RE: scrambled values in ComboBoxes
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).
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)