UI Messagebox within LMB method of a tool
-
vI have no idea how to make messagebox displayed within create method of a tool.
It is working but it is not visible. Sad I am afraid there is no solution.Thanks
Tomasz -
I have found solution. I had to move UI.messagebox to draw method.
If you display UI.messagebox in draw method it will be invoked twice
if not suppressed earlierif displayed==false displayed=true #to prevent second execution of whole if-end section UI.messagebox "Hello world!" displayed=false end
-
The .draw method is called every time you execute the view.invalidate method. Therefore, you control when the screen gets updated.
I know of no restrictions that UI.messagebox can only be placed in the .draw method. It can be placed anywhere. (I just tested it to confirm in both the onLeftButtonDown and initialize method).
Todd
-
Draw method is also executed when you open Messagebox within the method .
I have placed UI.mb in LMB method and it was not displayed. It was invisible but present, awaiting for user input. I cannot validate the view during UI.mb. Todd how have you achieved it?
I am still new to Tools methods so I could have done sth wrong.Tomasz
-
Can you post your code? It works great for me in the onLButtonDown method, both before and after the view.invalidate call.
Todd
If you don't want to post, send it to my fullname, no spaces, to my mac dot com address.
-
I have found it! Silly me. I have placed view.invalidate at the end of draw method
def draw(view) if( @ip1.valid? ) if( @ip1.display? ) @ip1.draw(view) @drawn = true end end if( @ip2.valid? ) @ip2.draw(view) if( @ip2.display?) self.draw_geometry(@ip1.position, @ip2.position, view) view.invalidate #WRONG! @drawn = true end end
Each time UI.messagebox was invoked SU called draw method which erased MB from the view.
Thanks
Tomasz
Advertisement