1 second pop-up, timed message
-
I can't seem to find how I can give a quick confirmation, like displaying 1 second: "Hello world" without the need to press [OK] or [X]
I thought I've found it, but it doesn't work:
dlg = UI::WebDialog.new("test", false, "test", 300, 200, 50, 150, false) dlg.set_html("Hello world") dlg.show start_timer(1, false) { dlg.close }
It does sometimes disappear but even when I don't use
start_timer(1, false) { dlg.close }
So that seems to be another bug?! Maybe only in SU 2013... -
Try:
module Onidarbe def self;;popup(message) # unless @dlg @dlg = UI;;WebDialog.new("Notice", false, "Onidarbe_Popup", 300, 200, 50, 150, false) end @dlg.set_html(message) if @dlg.visible? @dlg.bring_to_front else RUBY_PLATFORM =~ /darwin/i ? @dlg.show_modal ; @dlg.show end UI;;start_timer(1.0, false) { @dlg.close } # end # popup end
Onidarbe::popup("Operation complete.")
reasons:
- local vars in scripts get garbage collected soon after the script ends.
- all your code needs to be inside your own module
- you were attempting to call the
start_timer
module function without qualifying it by it's module. (It is not a global method.)
-
Short and ride to the point
Thanks again Dan! Have a nice new year's eve...
Advertisement