/ Published in: Ruby
This is an example of how to use the wxCocoaDialog dropdown widget from Ruby.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/usr/bin/env ruby -w COCOA_DIALOG = "#{ENV['TM_SUPPORT_PATH']}/bin/CocoaDialog.exe" res=%x("#{COCOA_DIALOG}" dropdown \ --title "Favorite OS" \ --text "What is your favorite operating system?" \ --items "Mac OS X" "OpenSolaris" "Windows" \ --button1 'That one!' --button2 "Cancel") button, item = res.split case button when "1": case item when "0": puts "Fanboy!" when "1": puts "ZFS Rules!" when "2": puts "Thank heaven for e and Cygwin!" end when "2": puts "Fine, be that way." else puts "Something went very, very wrong." end