blob: e8f2142e0749a03948389775cb733f73d8d7e7d7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
require "tk"
class TkDialog < TkWindow
# initialize tk_dialog
def initialize
super
@var = TkVariable.new
id = @var.id
INTERP._eval('eval {global '+id+';'+
'set '+id+' [tk_dialog '+
@path+" "+title+" \"#{message}\" "+bitmap+" "+
default_button+" "+buttons+']}')
end
def value
return @var.value.to_i
end
######################################################
# #
# these methods must be overridden for each dialog #
# #
######################################################
def title
return "DIALOG"
end
def message
return "MESSAGE"
end
def bitmap
return "info"
end
def default_button
return 0
end
def buttons
return "BUTTON1 BUTTON2"
end
end
#
# dialog for warning
#
class TkWarning < TkDialog
def initialize(mes)
@mes = mes
super()
end
def message
return @mes
end
def title
return "WARNING";
end
def bitmap
return "warning";
end
def default_button
return 0;
end
def buttons
return "OK";
end
end
|