Reputation: 59
I created a modal WebDialog using SketchUp Ruby API, here is my code.
my_dialog = UI::WebDialog.new("Lisence",false,"Selection Info",200,200,200,200,true)
my_dialog.add_action_callback("get_data") do |web_dialog,params|
end
html_path = Sketchup.find_support_file("liscence.html" ,"Plugins")
my_dialog.set_file(html_path)
my_dialog.show_modal
If user click on close button, then Sketchup main window will be active. My dialog has a button, I want user to have to click on this button to close dialog; so I want to disable "close" button in modal dialog.
So how can i do it?
Upvotes: 0
Views: 505
Reputation: 2914
There is no method in the SketchUp Ruby API to do so.
Under Windows you can use the Win32API
to modify the WebDialog frame. For examples you can look at my own library where I remove the minimize and maximize button: https://bitbucket.org/thomthom/tt-library-2/src/59abd704e6e93e9d1596a136d64949aabfc69708/TT_Lib2/win32.rb?at=Version%202.9#cl-404
Note that I compiled my own version of Daniel Berger's Win32::API
module so I could place it under my own namespace and avoid any potential clashes with other plugins since the Ruby 1.8 that ships with SketchUp only include the Core and not the Standard Library.
If you need OSX as well, then I don't know. I've not found a way to hook into the OSX window frame there. (Would love to find a way.)
Fallback could be to not hide it and use WebDialog.set_on_close
to catch any time the window closes.
Upvotes: 1