For some reason I am having issues to activate the native paint tool when calling Sketchup.send_action("selectPaintTool:") on SketchUp 2021 osx when called from within an HtmlDialog callback. It seems to never activate the tool.
I thought it might be a focus problem, so I already tried the de_focus hack by creating another dialog and quickcly opening and closing that. Unfortunately that did not help.
So, I tried this:
model = Sketchup.active_model
tool = {}
def tool.onMouseMove(flags, x, y, view)
Sketchup.send_action("selectPaintTool:")
end #def
model.select_tool(tool)
I mocked a fake tool who’s sole purpose is to activate the native one whenever the user moves the mouse and this fake tool is active. Seems to work fine and I thus wanted to share this with you.
That might work as well. I went for onMouseMove because I want to force () Sketchup with these send_action requests for as long as my tool is active, and thus the tool I want to be active is not
As soon as the Paint tool activated you tool (or a fake tool) will be no longer active…
…or you mean that one call is “not enough” for OSX to get the #sent_action(), so you keep forcing by each mouse move until OSX “understand” what you want?
It can also be the html callback were lost somehow.
I mean action callbacks are detached from the dialog somehow, e.g. if the dialog is close action callbacks are detached, then you did not attached it back properly??
This does not work with any tool. I have a scenario where I need to create a toolbar like html dialog to open tools with tutorials. Works fine on windows but on mac those buttons dont do anything.
What I found is that the main problem seems to be the focus on sketchup window. If it is focused within the time set then the timer solution works, otherwise the fake tool is the only solution I found.