FxRuby and GUI's
-
Is is possible to mix or incorporate FxRuby with SU Ruby
in order to produce better GUI's? -
I'm sure this has been tried before, not specifically using the Fox kit, but with GTK, or WxWindows... I've still never seen a working example. I think it is possible to do, but it must be harder than it first appears. There needs to be some type of software "connector" in between SU and the UI. Perhaps TBD will add his expertise.
WebDialogs are way better than the inputbox dialog interface, but require that you know HTML and a little Javascript. They are your best option for GUI's, although it would be nicer if there were some Widgets we could use out-of-the-box.
-
@jim said:
...although it would be nicer if there were some Widgets we could use out-of-the-box.
Jim, can you give me an example of what you mean?
-
Checkboxes, dropdowns, text inputs. I'm thinking of the dialog being created on the fly from prompt strings and variables.
webdialog.add_widget(CHECKBOX, "Label", ruby_variable_binding) webdialog.add_widget(DROPDOWN, %w( opt1 opt2 opt3 ), default_opt, ruby_variable_binding) webdialog.add_widget(SLIDER, min, max, width, "label", ruby_variable_binding) values = webdialog.display
and that would be the complete dialog code in a plugin.
-
FxRuby is really cool to extend SU_Ruby!
-
@jim said:
Checkboxes, dropdowns, text inputs. I'm thinking of the dialog being created on the fly from prompt strings and variables.
> webdialog.add_widget(CHECKBOX, "Label", ruby_variable_binding) > webdialog.add_widget(DROPDOWN, %w( opt1 opt2 opt3 ), default_opt, ruby_variable_binding) > webdialog.add_widget(SLIDER, min, max, width, "label", ruby_variable_binding) > values = webdialog.display >
and that would be the complete dialog code in a plugin.
That could be done. If I get it started and working, would you take it over?
(Oh, and nice job wikii!)
-
@unknownuser said:
That could be done. If I get it started and working, would you take it over?
Thanks but no. I'm not ready to think about it right now; and the example I gave was just off the top of my head. It's not a 5 minute script, but more like a 5 month project to do it right. I need to actually understand Javascript first; instead of copying examples I find online.
I want to work on creating a consistent and simple interface for all observers. I think I have a good pattern now for them. I'll start a new thread for it, although I gave an example here.
-
Run following code in Sketchup , when I click the button "Quit", The promopte "Quit has been clicked!" can be printed,but dialog does't disappear . It sames that method "exit" for application can't finish the program in Sketchup! But in Ruby 1.8 , it works well. Why?
require 'fox16' include Fox application = FXApp.new("Hello", "FoxTest") main = FXMainWindow.new(application, "Hello", nil, nil, DECOR_ALL) a_button=FXButton.new(main, "&Quit!", nil, application, FXApp;;ID_QUIT) a_button.connect(SEL_COMMAND){ p "Quit has been clicked!" application.exit } application.create() main.show(PLACEMENT_SCREEN) application.run()
Advertisement