Return to Snippet

Revision: 2276
at January 30, 2007 18:47 by gtcaz


Updated Code
#!/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

Revision: 2275
at January 29, 2007 20:29 by gtcaz


Updated Code
#!/usr/bin/env ruby -w

COCOA_DIALOG = '/cygdrive/c/Program Files/e/Support/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

Revision: 2274
at January 29, 2007 20:25 by gtcaz


Updated Code
#!/usr/bin/env ruby -w

COCOA_DIALOG = '/cygdrive/c/Program Files/e/Support/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

Revision: 2273
at January 29, 2007 20:24 by gtcaz


Updated Code
#!/usr/bin/env ruby -w

COCOA_DIALOG = '/cygdrive/c/Program Files/e/Support/bin/CocoaDialog.exe'

res=%x("#{COCOA_DIALOG}" dropdown \
    --title "Favorite OS" \
    --text "What is your favorite operating system?" \
    --items "Mac OS X" "GNU/Linux" "Windows" --button1 'That one!' \
    --button2 "Cancel")

button, item = res.split

case button
  when "1": 
    case item
      when "0": puts "Fanboy!"
      when "1": puts "Linux geek!"
      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

Revision: 2272
at January 29, 2007 20:07 by gtcaz


Initial Code
#!/usr/bin/env ruby -w

COCOA_DIALOG = '/cygdrive/c/Program Files/e/Support/bin/CocoaDialog.exe'

res=%x("#{COCOA_DIALOG}" dropdown \
    --title "Favorite Cofee Drink" \
    --text "What is your Favorite Cofee Drink?" \
    --items "Mac OS X" "GNU/Linux" "Windows" --button1 'That one!' \
    --button2 "Cancel")

button, item = res.split

case button
  when "1": 
    case item
      when "0": puts "You like Mac OS X!"
      when "1": puts "Linux geek!"
      when "2": puts "Thank heaven for e and Cygwin!!"
    end
  when "2": puts "Fine, be that way."
  else puts "Something went very wrong!"
end

Initial URL


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

Initial Title
wxCocoaDialog dropdown example in Ruby

Initial Tags
ruby

Initial Language
Ruby