~ubuntu-branches/ubuntu/hardy/ruby1.8/hardy-updates

« back to all changes in this revision

Viewing changes to ext/tk/sample/demos-en/dialog1.rb

  • Committer: Bazaar Package Importer
  • Author(s): akira yamada
  • Date: 2007-03-13 22:11:58 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070313221158-h3oql37brlaf2go2
Tags: 1.8.6-1
* new upstream version, 1.8.6.
* libruby1.8 conflicts with libopenssl-ruby1.8 (< 1.8.6) (closes: #410018)
* changed packaging style to cdbs from dbs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# a dialog box with a local grab (called by 'widget')
 
3
#
 
4
class TkDialog_Demo1 < TkDialog
 
5
  ###############
 
6
  private
 
7
  ###############
 
8
  def title
 
9
    "Dialog with local grab"
 
10
  end
 
11
 
 
12
  def message
 
13
    'This is a modal dialog box.  It uses Tk\'s "grab" command to create a "local grab" on the dialog box.  The grab prevents any pointer-related events from getting to any other windows in the application until you have answered the dialog by invoking one of the buttons below.  However, you can still interact with other applications.'
 
14
  end
 
15
 
 
16
  def bitmap
 
17
    'info'
 
18
  end
 
19
 
 
20
  def default_button
 
21
    0
 
22
  end
 
23
 
 
24
  def buttons
 
25
    # ["Dismiss", "", "Show Code"]
 
26
    ["OK", "Cancel", "Show Code"]
 
27
  end
 
28
end
 
29
 
 
30
ret =  TkDialog_Demo1.new('message_config'=>{'wraplength'=>'4i'}).value
 
31
case ret
 
32
when 0
 
33
  print "You pressed OK\n"
 
34
when 1
 
35
  print "You pressed Cancel\n"
 
36
when 2
 
37
  showCode 'dialog1'
 
38
end