OSDN Git Service

20021009版ソース
[seraphyscrtools/SeraphyScriptTools.git] / TestScript / class2.vbs
1
2 Option Explicit
3
4 Dim Obj
5 Set Obj = WScript.CreateObject("SeraphyScriptTools.Instance")
6 WScript.ConnectObject Obj.MainFrame,"Main_"
7
8 With Obj.MainFrame
9     With .Form
10         .Label("HELLO!")
11         .Button("Create New Frame").SetID(50)
12     End With
13     .SetPlacement ,,300,150
14     .Open "SeraphyScriptTools Test1"
15 End With
16
17 Obj.MainFrame.DoModal
18
19 WScript.DisconnectObject Obj.MainFrame
20
21 '---------------------------------------------------------
22 '\81@\83C\83x\83\93\83g\83n\83\93\83h\83\89
23 sub Main_OnCommand()
24     dim ev
25     set ev = Obj.MainFrame.Event
26     if(ev.Parameter = 50) then
27         CreateNewFrame
28     end if
29 end sub
30
31 sub Main_OnKeydown()
32     dim ev
33     set ev = Obj.MainFrame.Event
34         msgbox ev.parameter
35 end sub
36
37 '---------------------------------------------------------
38\83T\83u\83E\83B\83\93\83h\83E\82Ì\83N\83\89\83X\92è\8b`
39 class ChildWnd
40 public wnd
41 private color
42 private fillcolor
43 private fontcolor
44 public this_count
45 private sub class_initialize
46         set wnd = Obj.MainFrame.CreateChild
47         color = int(Rnd() * &hFFFFFF)
48         fillcolor = int(Rnd() * &hFFFFFF)
49         fontcolor = int(Rnd() * &hFFFFFF)
50         this_count = count
51         with wnd
52                 .ClassObject = me
53                 .SetPlacement ,,150,150
54                 with .form
55                         .button "A"
56                         .button "B"
57                 end with
58         .BackColor = int(Rnd() * &hFFFFFF)
59         .Open "SUBFRAME " & count
60     end with
61 end sub
62 Private Sub Class_Terminate
63         MsgBox "Terminate"
64 end sub
65 public sub OnSize
66         dim width,height
67     width  = wnd.innerwidth
68     height = wnd.innerheight
69     With wnd.Canvas.Layer(0)
70         .Clear
71                 .SetMappingMode 0
72                 .color = color
73                 .fillcolor = fillcolor
74                 .fontcolor = fontcolor
75                 .FillCircle width/2,height/2,width/2
76                 .Text width/2,height/2,"No." & this_count
77                 .Text 0,height,width & "," & height
78         End With
79 end sub
80 end class
81
82 '---------------------------------------------------------
83\95â\8f\95\83T\83u\83\8b\81[\83`\83\93
84 Dim count
85 sub CreateNewFrame()
86         dim child
87         count = count + 1
88         set child = new ChildWnd
89 end sub