c++ preview event occurs before command inputChanged updates

c++ preview event occurs before command inputChanged updates

Anonymous
Not applicable
480 Views
3 Replies
Message 1 of 4

c++ preview event occurs before command inputChanged updates

Anonymous
Not applicable

I'm running a c++ script that modifies user parameters using spinner controls.  It updates the user parameter expression with the value of the spinner expression if they differ.

 

Everything seems to work ok, except that I noticed that the preview event occurs before the input changed  event, so the preview update is always one behind the value displayed in the spinner.

 

Is there a way to initiate a preview event after the input changed event?

Thanks

Jay

0 Likes
Accepted solutions (1)
481 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

I just wanted to add the log of debug output from within the  event handlers.  Note that the OnPreviewEventHandler  is being called 

before the OnInputChangedEventHandler, and in this case the spinner expression and value haven't been updated to 2.50 in from 2.00 in.

 

[5908] OnInputChangedEventHandler
[5908] H_Base
[5908] 2.00 in
[5908] QWidget::paintEngine: Should no longer be called
[5908] QPainter::begin: Paint device returned engine == 0, type: 1
[5908] H_Base
[5908] 2.00 in
[5908] OnPreviewEventHander
[5908] OnInputChangedEventHandler
[5908] H_Base
[5908] 2.50 in

0 Likes
Message 3 of 4

Anonymous
Not applicable

Never mind.  I found that the spinner's double value is updated before the preview call, so I can create the expression from that.  It was just the spinner's expression that was not yet updated.

0 Likes
Message 4 of 4

Anonymous
Not applicable
Accepted solution

I'm attaching my source file, since some of these things aren't available in the examples.  I'm just running it from the add-ins menu.  It displays all the user variable names with a spinner associated with each, and enables update on any spinner modification with the preview event, and on OK button with the execute event.

 

There were other issues I saw ... the menu dialog box didn't auto-adjust in size unless I put the table inside a Tab, for example.  I saw later that there is an api call to set the menu dimensions, but haven't gone back to remove the tab.

 

Another thing was that there needed to be a icons folder in the same project director as the source file.  I copied the resources folder from one of the examples rather than creating one of my own, but I see in the docs now that there may be more icons needed.  Anyway, I'm just uploading the cpp file.

 

It uses a windows specific debug output visible in the sysinternals debug viewer. 

 

 

0 Likes