Posted By

gtcaz on 01/29/07


Tagged

ruby e wxCocoaDialog


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

gbvb
vali29
webstic


wxCocoaDialog dropdown example in Ruby


 / Published in: Ruby
 

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

  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  

You need to login to post a comment.