Browse CVS Repository
Contents of /exerb/exerb-studio/form/eval.rb
Parent Directory
| Revision Log
| Revision Graph
Revision 1.2 -
( show annotations)
( download)
Fri Jun 13 04:21:59 2003 UTC
(20 years, 10 months ago)
by yuya
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +10 -0 lines
* 実行ボタンを追加
| 1 |
|
| 2 |
module Form |
| 3 |
|
| 4 |
class Eval < VRModalDialog |
| 5 |
|
| 6 |
def construct |
| 7 |
self.caption = 'Eval' |
| 8 |
|
| 9 |
w, h = 415, 320 |
| 10 |
self.move(@screen.w / 2 - w / 2, @screen.h / 2 - h / 2, w, h) |
| 11 |
|
| 12 |
ctrls = [] |
| 13 |
ctrls << self.addControl(VRStatic, "lab1", "Source", 5, 5, 400, 15) |
| 14 |
ctrls << self.addControl(VRText, "source", "", 5, 20, 400, 150) |
| 15 |
ctrls << self.addControl(VRStatic, "lab2", "Result", 5, 175, 400, 15) |
| 16 |
ctrls << self.addControl(VRText, "result", "", 5, 190, 400, 100) |
| 17 |
|
| 18 |
ctrls << self.addControl(VRButton, "btn_execute", "&Execute", 0, 0, 5, 5) |
| 19 |
|
| 20 |
font = @screen.factory.newfont("Terminal", 14) |
| 21 |
ctrls.each { |ctrl| ctrl.setFont(font) } |
| 22 |
end |
| 23 |
|
| 24 |
def btn_execute_clicked |
| 25 |
begin |
| 26 |
@result.text = eval(@source.text).inspect |
| 27 |
rescue Exception => e |
| 28 |
@result.text = e.inspect |
| 29 |
end |
| 30 |
end |
| 31 |
|
| 32 |
end |
| 33 |
|
| 34 |
end |
| |