Button on/off staying on

unhandled

#1

Hello,

I got a bug difficult to reproduce : a button sometimes continue sending “True” to its value listener while the user has released the mouse button.
Where can this come from ?
The button returns to a normal bevahior when i manually desable and enable it.

Thank you in advance,

JL


#2

Andrew I can send to you my definition privatly if you need it.

… It’s always the same problem of lauching external treatment (word document generation with COM) and notify correctly its end on the GH/HUI user interface :


(Andrew Heumann) #3

Yes, why don’t you send me a copy of your definition and I can take a look. But my response to the other topic holds; if I can’t reproduce it, it’s extremely hard to solve the problem.


(Andrew Heumann) #4

and as per the replies to the second post - the simpler the definition you can send that exhibits the problem, the better.


(Andrew Heumann) #5

I have reviewed the file you sent, and reproduced the issue in question (this in itself was not easy!). I am fairly sure the problem is with either your script or with Grasshopper itself - there have been prior reports of scripting components in GH with slow/long running functions failing to return control of mouse events back to the canvas. I do not think this issue in general is something I can solve.
However, I can recommend a workaround. In my preliminary tests this approach below eliminates the problem you are experiencing - though I can’t guarantee it will always do so. Rather than using metahopper enable/disable on your script, I would recommend leaving the script enabled and using MetaHopper “Set object value” to decouple the button triggering the script from the value returning from HUI. This is easier to demonstrate than explain:
image

In my tests with this configuration, the button consistently returned to false and the script never double-solved.

In general, these “decoupled” scenarios using metahopper with Human UI make for more reliable and easier to maintain grasshopper definitions - it removes a wired connection from the output of the HUI into the “business logic” of the definition in favor of a “remote” or wireless connection. There are many examples of this in the “Decoupled Snippets” available on the HUI food4rhino page.

Hope this helps.


#6

Thanks you very much for the time you spent, Andrew.
I think it will help - i imagined a solution such as this one. I’ll let you now :slight_smile:


#7

Well i met the same problem using the decoupled scenario. After some tests, the HUI button was staying on True value systematically (even after manually having disabled and enabled it), until I delete the Create Button component and create a new one. Painfull…


#8

Here is a clue :
In the VB component started with the Button, I have been replacing the following line, warning the end of the Word generation to the user :

Rhino.UI.Dialogs.ShowMessageBox(“It’s finished!”)

by

System.Windows.Forms.MessageBox.Show(“It’s finished!”).

(I did that because Rhino.UI.Dialogs.ShowMessageBox() has been been removed in Rhino 6 and i want a code compatible with both Rhino 5 and Rhino 6)

With the System.Windows.Forms.MessageBox.Show() call, the bug is systematic, not depending on that fact that the decoupled scenario is implemented or not.

JL


#9

Is there a way to detect the end of the slow/long running function, and then force the HUI button to False, without Grasshopper detecting a loop in the definition ?

JL