wxCocoaDialog dropdown example in Ruby


/ Published in: Ruby
Save to your folder(s)

This is an example of how to use the wxCocoaDialog dropdown widget from Ruby.


Copy this code and paste it in your HTML
  1. #!/usr/bin/env ruby -w
  2.  
  3. COCOA_DIALOG = "#{ENV['TM_SUPPORT_PATH']}/bin/CocoaDialog.exe"
  4.  
  5. res=%x("#{COCOA_DIALOG}" dropdown \
  6. --title "Favorite OS" \
  7. --text "What is your favorite operating system?" \
  8. --items "Mac OS X" "OpenSolaris" "Windows" \
  9. --button1 'That one!' --button2 "Cancel")
  10.  
  11. button, item = res.split
  12.  
  13. case button
  14. when "1":
  15. case item
  16. when "0": puts "Fanboy!"
  17. when "1": puts "ZFS Rules!"
  18. when "2": puts "Thank heaven for e and Cygwin!"
  19. end
  20. when "2": puts "Fine, be that way."
  21. else puts "Something went very, very wrong."
  22. end

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.