Project

General

Profile

progress_bar_test6.p

Marius Gligor, 10/29/2019 11:23 AM

Download (5.08 KB)

 
1
define variable progBar as handle no-undo.
2

    
3
define button button-1 
4
     label "Start" 
5
     size 15 by 1.14.
6

    
7
define button button-2 auto-end-key 
8
     label "Exit" 
9
     size 15 by 1.14.
10

    
11
define button button-3 
12
     label "+" 
13
     size 15 by 1.14.
14

    
15
define button button-4
16
     label "-" 
17
     size 15 by 1.14.
18

    
19
define button button-5 
20
     label "0" 
21
     size 15 by 1.14.
22

    
23
def frame f 
24
     button-1 at row 1.95 col 5
25
     button-2 at row 1.95 col 25
26
     button-3 at row 1.95 col 45 
27
     button-4 at row 1.95 col 65
28
     button-5 at row 1.95 col 85
29
	with size-pixels 640 by 480 overlay 
30
	view-as dialog-box title "Progress Bar widget".
31

    
32
create progress-bar progBar 
33
   assign
34
     frame = frame f:handle
35
       row    = 3.62
36
       column = 5
37
       height = 1.2
38
       width  = 104
39
       visible = true.
40

    
41
/* progress-bar methods and attributes */
42
/* progBar:pb-Enabled = True. */
43
progBar:ole-Drop-Mode = 1.
44
progBar:pb-Appearance = 1.
45
progBar:pb-Border-Style = 0.
46
progBar:pb-Orientation = 0.
47
progBar:pb-Scrolling = 1.
48
progBar:pb-Max = 100.
49
progBar:pb-Min = 0.
50
progBar:pb-Value = 30.
51
progBar:pb-Mouse-Pointer = 3.
52
/* progBar:pb-Mouse-Icon = "user-cursor.png". */
53
progBar:ole-Drag().
54
progBar:pb-Refresh().
55

    
56
/* progress-bar mouse events */
57
on "mouse-click" of progBar do:
58
    message "Click!".
59
end.
60

    
61
on "mouse-down" of progBar do: 
62
   define variable Button as integer.
63
   define variable Shift as integer.
64
   define variable x as integer.
65
   define variable y as integer.
66

    
67
   Button = progBar:ocx-mouse-Button.
68
   Shift  = progBar:ocx-mouse-Shift.
69
   x = progBar:ocx-mouse-x.
70
   y = progBar:ocx-mouse-y.
71

    
72
   message "MouseDown!" x y Button Shift.
73
end.
74

    
75
on "mouse-move" of progBar do: 
76
   define variable Button as integer.
77
   define variable Shift as integer.
78
   define variable x as integer.
79
   define variable y as integer.
80

    
81
   Button = progBar:ocx-mouse-Button.
82
   Shift  = progBar:ocx-mouse-Shift.
83
   x = progBar:ocx-mouse-x.
84
   y = progBar:ocx-mouse-y.
85

    
86
   message "MouseMove!" x y Button Shift.
87
end.
88

    
89
on "mouse-up" of progBar do: 
90
   define variable Button as integer.
91
   define variable Shift as integer.
92
   define variable x as integer.
93
   define variable y as integer.
94

    
95
   Button = progBar:ocx-mouse-Button.
96
   Shift  = progBar:ocx-mouse-Shift.
97
   x = progBar:ocx-mouse-x.
98
   y = progBar:ocx-mouse-y.
99

    
100
   message "MouseUp!" x y Button Shift.
101
end.
102

    
103
/* progress-bar ole events */
104
on "ole-complete-drag" of progBar do:
105
   define variable Effect as integer.
106
   
107
   effect = progBar:ole-effect.
108
   message "OLECompleteDrag" Effect.
109
end.
110

    
111
on "ole-drag-drop" of progBar do:
112
   define variable Data as component-handle.
113
   define variable Effect as integer.
114
   define variable Button as integer.
115
   define variable Shift as integer.
116
   define variable x as decimal.
117
   define variable y as decimal.
118

    
119
   data = progBar:com-data.
120
   effect = progBar:ole-effect.
121
   Button = progBar:ocx-mouse-Button.
122
   Shift  = progBar:ocx-mouse-Shift.
123
   x = progBar:ole-x.
124
   y = progBar:ole-y.
125

    
126
   message "OLEDragDrop" Button Shift Effect x y.
127
end.
128

    
129
on "ole-drag-over" of progBar do:
130
   define variable Data as component-handle.
131
   define variable Effect as integer.
132
   define variable Button as integer.
133
   define variable Shift as integer.
134
   define variable x as decimal.
135
   define variable y as decimal.
136
   define variable State as integer.
137

    
138
   data = progBar:com-data.
139
   effect = progBar:ole-effect.
140
   Button = progBar:ocx-mouse-Button.
141
   Shift  = progBar:ocx-mouse-Shift.
142
   x = progBar:ole-x.
143
   y = progBar:ole-y.
144
   state = progBar:ole-state.
145

    
146
   message "OLEDragOver" Button Shift Effect x y State.
147
end.
148

    
149
on "ole-give-feedback" of progBar do:
150
   define variable Effect as integer.
151
   define variable DefaultCursors as logical.
152

    
153
   effect = progBar:ole-effect.
154
   DefaultCursors = progBar:ole-default-cursors.
155
   message "OLEGiveFeedback" Effect DefaultCursors.
156
end.
157

    
158
on "ole-set-data" of progBar do:
159
   define variable Data as component-handle.
160
   define variable DataFormat as integer.
161

    
162
   data = progBar:com-data.
163
   dataFormat = progBar:ole-data-format.
164
   message "OLESetData" DataFormat.
165
   Data:Clear().
166
end.
167

    
168
on "ole-start-drag" of progBar do:
169
   define variable Data as component-handle.
170
   define variable AllowedEffects as integer.
171

    
172
   data = progBar:com-data.
173
   AllowedEffects = progBar:ole-allowed-effects.
174
   message "OLEStartDrag" AllowedEffects.
175
   Data:GetData(15).
176
   Data:Files.
177
   Data:Item(0).
178
end.
179

    
180

    
181
on choose of button-1 do:
182
    progBar:pb-Value = 0.
183
    run test_progress.
184
end.
185

    
186
on choose of button-3 do:
187
    define variable pbVal as integer no-undo.
188
    pbVal = progBar:pb-Value.
189
    progBar:pb-Value = pbVal + 1.
190
end.
191

    
192
on choose of button-4 do:
193
    define variable pbVal as integer no-undo.
194
    pbVal = progBar:pb-Value.
195
    progBar:pb-Value = pbVal - 1.
196
END.
197

    
198
on choose of button-5 do:
199
    define variable pbVal as integer no-undo.
200
    pbVal = progBar:pb-min.
201
    progBar:pb-Value = pbVal.
202
    progBar:OLE-Drag().
203
END.
204

    
205
procedure test_progress :
206
define variable icount as integer no-undo.
207

    
208
do iCount = 1 to progBar:pb-Max :
209
    progBar:pb-Value = iCount.
210
    progBar:pb-Refresh( ).
211
end.
212
end procedure.
213

    
214
enable all with frame f.
215

    
216
wait-for window-close of current-window.
217

    
218