vdfsplat / AppSrc / Test.src
History | View | Annotate | Download (13.2 KB)
1 | 2 | wil | // TestProject for Windows application |
---|---|---|---|
2 | |||
3 | Use DFAllEnt.pkg |
||
4 | Use cCJStandardCommandBarSystem.pkg |
||
5 | |||
6 | Object oHtmlHelp is a cHtmlHelp |
||
7 | End_Object |
||
8 | |||
9 | Object oApplication is a cApplication |
||
10 | Set pbPreserveEnvironment to False |
||
11 | Set peHelpType to htHtmlHelp |
||
12 | End_Object |
||
13 | |||
14 | Use oEditContextMenu.pkg |
||
15 | Use oDEOEditContextMenu.pkg |
||
16 | |||
17 | Object oMain is a Panel |
||
18 | |||
19 | Property Handle phoViewMenu 0 |
||
20 | Property Handle phoReportMenu 0 |
||
21 | |||
22 | Set Label to "Vdf bug SPLAT!" |
||
23 | Set Location to 4 3 |
||
24 | Set Size to 300 650 |
||
25 | |||
26 | Object oCommandBarSystem is a cCJCommandBarSystem |
||
27 | Set pbTimerUpdate to True |
||
28 | |||
29 | Procedure OnCreateCommandBars |
||
30 | Handle hoOptions |
||
31 | Get OptionsObject to hoOptions |
||
32 | Forward Send OnCreateCommandBars |
||
33 | End_Procedure |
||
34 | |||
35 | Object oMenuBar is a cCJMenuBar |
||
36 | |||
37 | Object oFileMenu is a cCJMenuItem |
||
38 | Set peControlType to xtpControlPopup |
||
39 | Set psCaption to "&File" |
||
40 | Set psDescription to "Find, Save, Delete, Clear information or quit this application." |
||
41 | Set psCategory to "Menus" |
||
42 | |||
43 | Object oClearMenuItem is a cCJClearMenuItem |
||
44 | Set pbAddToDesignerMenu to True |
||
45 | End_Object |
||
46 | |||
47 | Object oClearAllMenu is a cCJClearAllMenuItem |
||
48 | Set pbAddToDesignerMenu to True |
||
49 | End_Object |
||
50 | |||
51 | Object oPromptMenuItem is a cCJPromptMenuItem |
||
52 | Set pbAddToDesignerMenu to True |
||
53 | Set pbControlBeginGroup to True |
||
54 | End_Object |
||
55 | |||
56 | Object oFindMenuItem is a cCJFindMenuItem |
||
57 | Set pbAddToDesignerMenu to True |
||
58 | Set pbControlBeginGroup to True |
||
59 | End_Object |
||
60 | |||
61 | Object oFindNextMenu is a cCJFindNextMenuItem |
||
62 | Set pbAddToDesignerMenu to True |
||
63 | End_Object |
||
64 | |||
65 | Object oFindPreviousMenu is a cCJFindPreviousMenuItem |
||
66 | Set pbAddToDesignerMenu to True |
||
67 | End_Object |
||
68 | |||
69 | Object oFindFirstMenu is a cCJFindFirstMenuItem |
||
70 | Set pbAddToDesignerMenu to True |
||
71 | End_Object |
||
72 | |||
73 | Object oFindLastMenu is a cCJFindLastMenuItem |
||
74 | Set pbAddToDesignerMenu to True |
||
75 | End_Object |
||
76 | |||
77 | Object oSaveMenuItem is a cCJSaveMenuItem |
||
78 | Set pbAddToDesignerMenu to True |
||
79 | Set pbControlBeginGroup to True |
||
80 | End_Object |
||
81 | |||
82 | Object oDeleteMenuItem is a cCJDeleteMenuItem |
||
83 | Set pbAddToDesignerMenu to True |
||
84 | End_Object |
||
85 | |||
86 | Object oExitMenu is a cCJExitMenuItem |
||
87 | Set pbControlBeginGroup to True |
||
88 | End_Object |
||
89 | |||
90 | End_Object |
||
91 | |||
92 | Object oViewMenu is a cCJMenuItem |
||
93 | Set peControlType to xtpControlPopup |
||
94 | Set psCaption to "&View" |
||
95 | Set psToolTip to "View" |
||
96 | Set psDescription to "Available Views" |
||
97 | |||
98 | Object ooRemoteDesktopMenuItem is a cCJMenuItem |
||
99 | Set psCaption to "oRemoteDesktop" |
||
100 | Set psTooltip to "oRemoteDesktop" |
||
101 | |||
102 | Procedure OnExecute Variant vCommandBarControl |
||
103 | Handle hoClient |
||
104 | Get Client_Id to hoClient |
||
105 | Send Activate_oRemoteDesktop of hoClient |
||
106 | End_Procedure |
||
107 | End_Object |
||
108 | End_Object |
||
109 | |||
110 | Object oReportMenu is a cCJMenuItem |
||
111 | Set peControlType to xtpControlPopup |
||
112 | Set psCaption to "&Report" |
||
113 | Set psToolTip to "Report" |
||
114 | Set psDescription to "Available Reports" |
||
115 | End_Object |
||
116 | |||
117 | Object oNavigateMenu is a cCJMenuItem |
||
118 | Set peControlType to xtpControlPopup |
||
119 | Set psCaption to "&Navigate" |
||
120 | Set psTooltip to "Navigate" |
||
121 | Set psDescription to "Move to different areas of the application" |
||
122 | |||
123 | Object oNextAreaMenu is a cCJNextAreaMenu |
||
124 | End_Object |
||
125 | |||
126 | Object oPriorAreaMenu is a cCJPriorAreaMenu |
||
127 | End_Object |
||
128 | |||
129 | Object oNextViewMenu is a cCJNextViewMenu |
||
130 | End_Object |
||
131 | |||
132 | Object oPriorViewMenu is a cCJPriorViewMenu |
||
133 | End_Object |
||
134 | |||
135 | Object oPromptMenu is a cCJPromptMenuItem |
||
136 | Set pbControlBeginGroup to True |
||
137 | End_Object |
||
138 | |||
139 | Object oZoomMenu is a cCJZoomMenuItem |
||
140 | End_Object |
||
141 | |||
142 | End_Object |
||
143 | |||
144 | Object oWindowMenu is a cCJMDIWindowsMenuItem |
||
145 | Set peControlType to xtpControlPopup |
||
146 | Set psCaption to "&Window" |
||
147 | Set psToolTip to "Window" |
||
148 | Set psDescription to "Display Current Views and set other display options." |
||
149 | |||
150 | // These are the static windows items. More will be created in onInitPopup |
||
151 | Object oDisplayOptionsMenu is a cCJMenuItem |
||
152 | Set peControlType to xtpControlPopup |
||
153 | Set psCaption to "&Display Options" |
||
154 | Set psToolTip to "Display Options" |
||
155 | Set psDescription to "Set display options" |
||
156 | |||
157 | Object oStatusbarMenu is a cCJStatusbarMenuItem |
||
158 | End_Object |
||
159 | |||
160 | Object oAutoArrangeIconsMenu is a cCJAutoArrangeIconsMenuItem |
||
161 | End_Object |
||
162 | |||
163 | Object oRestoreMenusMenu is a cCJRestoreMenusMenuItem |
||
164 | Set pbControlBeginGroup to True |
||
165 | End_Object |
||
166 | |||
167 | End_Object |
||
168 | |||
169 | Object oCascadeMenu is a cCJCascadeMenuItem |
||
170 | Set pbControlBeginGroup to True |
||
171 | End_Object |
||
172 | |||
173 | Object oHorizTile is a cCJTileHorizontally |
||
174 | End_Object |
||
175 | |||
176 | Object oVertTile is a cCJTileVertically |
||
177 | End_Object |
||
178 | |||
179 | Object oMinimizeMenuItem is a cCJMinimizeWindowsMenuItem |
||
180 | Set pbControlBeginGroup to True |
||
181 | End_Object |
||
182 | |||
183 | Object oRestoreMenuItem is a cCJRestoreWindowsMenuItem |
||
184 | End_Object |
||
185 | |||
186 | Object oArrangeIconsMenuItem is a cCJAutoArrangeIconsMenuItem |
||
187 | Set pbControlBeginGroup to True |
||
188 | End_Object |
||
189 | |||
190 | End_Object |
||
191 | |||
192 | Object oHelpMenu is a cCJMenuItem |
||
193 | Set peControlType to xtpControlPopup |
||
194 | Set psCaption to "&Help" |
||
195 | Set psDescription to "Access Information for learning and using this DataFlex application." |
||
196 | Set psToolTip to "Help" |
||
197 | |||
198 | Object oHelpMenuItem is a cCJHelpMenuItem |
||
199 | End_Object |
||
200 | |||
201 | Object oAboutMenuItem is a cCJAboutMenuItem |
||
202 | End_Object |
||
203 | |||
204 | End_Object |
||
205 | |||
206 | End_Object |
||
207 | |||
208 | Object oFindToolBar is a cCJToolbar |
||
209 | Set psTitle to "Finding Toolbar" |
||
210 | |||
211 | Object oFindFirstTool is a cCJFindFirstMenuItem |
||
212 | End_Object |
||
213 | |||
214 | Object oFindPreviousTool is a cCJFindPreviousMenuItem |
||
215 | End_Object |
||
216 | |||
217 | Object oFindMenuTool is a cCJFindMenuItem |
||
218 | End_Object |
||
219 | |||
220 | Object oFindNextTool is a cCJFindNextMenuItem |
||
221 | End_Object |
||
222 | |||
223 | Object oFindLastTool is a cCJFindLastMenuItem |
||
224 | End_Object |
||
225 | |||
226 | Object oPromptToolItem is a cCJPromptMenuItem |
||
227 | Set pbControlBeginGroup to True |
||
228 | End_Object |
||
229 | |||
230 | End_Object |
||
231 | |||
232 | Object oFileToolBar is a cCJToolbar |
||
233 | Set psTitle to "Data Entry Toolbar" |
||
234 | |||
235 | Object oClearToolItem is a cCJClearMenuItem |
||
236 | Set peControlStyle to xtpButtonIconAndCaption |
||
237 | End_Object |
||
238 | |||
239 | Object oClearAllToolItem2 is a cCJClearAllMenuItem |
||
240 | Set peControlStyle to xtpButtonIconAndCaption |
||
241 | End_Object |
||
242 | |||
243 | Object oSaveToolItem is a cCJSaveMenuItem |
||
244 | Set peControlStyle to xtpButtonIconAndCaption |
||
245 | Set pbControlBeginGroup to True |
||
246 | End_Object |
||
247 | |||
248 | Object oDeleteToolItem is a cCJDeleteMenuItem |
||
249 | Set peControlStyle to xtpButtonIconAndCaption |
||
250 | End_Object |
||
251 | |||
252 | End_Object |
||
253 | |||
254 | Object oEditToolBar is a cCJToolbar |
||
255 | Set psTitle to "Edit Toolbar" |
||
256 | |||
257 | Object oCutToolbarItem is a cCJCutMenuItem |
||
258 | End_Object |
||
259 | |||
260 | Object oCopyToolbarItem is a cCJCopyMenuItem |
||
261 | End_Object |
||
262 | |||
263 | Object oPasteToolbarItem is a cCJPasteMenuItem |
||
264 | End_Object |
||
265 | |||
266 | Object oDeleteEditToolbarItem is a cCJDeleteEditMenuItem |
||
267 | Set pbControlBeginGroup to True |
||
268 | End_Object |
||
269 | |||
270 | End_Object |
||
271 | |||
272 | Object oStatusBar is a cCJStatusBar |
||
273 | |||
274 | Object oStatusPane1 is a cCJStatusBarPane |
||
275 | Set piID to sbpIDIdlePane |
||
276 | Set pbStyleStretch to True |
||
277 | End_Object |
||
278 | |||
279 | Object oStatusPane2 is a cCJStatusBarPane |
||
280 | Set phoViewPane to Self |
||
281 | Set pbStyleStretch to True |
||
282 | End_Object |
||
283 | |||
284 | End_Object |
||
285 | |||
286 | // for testing we define the view and report menus for auto activate |
||
287 | Delegate Set phoViewMenu to (oViewMenu) |
||
288 | Delegate Set phoReportMenu to (oReportMenu) |
||
289 | |||
290 | End_Object |
||
291 | |||
292 | Object oClientArea is a ClientArea |
||
293 | |||
294 | Use StdAbout.pkg |
||
295 | Use RemoteDesktop.vw |
||
296 | |||
297 | Procedure Activate_About |
||
298 | Send DoAbout "Test Windows Project" "0.0.0" "" "" "" |
||
299 | End_Procedure |
||
300 | |||
301 | End_Object |
||
302 | |||
303 | |||
304 | // All of the code below are methods and augmentations which makes this work well as a test program. This: |
||
305 | // 1. Supports an auto-activate feature where all dialogs in the view and report menu are activated upon startup |
||
306 | // 2. forces the panel to resize if it is not large enough to accomodate all of the views. |
||
307 | // This code was placed directly in the testproject template and, therefore, directly in the .src file so |
||
308 | // a developer can easily modify this to fit their own needs. It is not expected that these techniques would |
||
309 | // get used in actual deployed projects. |
||
310 | |||
311 | // special test component code to activate all views and reports. For testing we assume |
||
312 | // that you want to see everything. |
||
313 | |||
314 | Procedure AutoActivate |
||
315 | handle hoMenu |
||
316 | |||
317 | // this activates all views from the view menu |
||
318 | Get phoViewMenu to hoMenu |
||
319 | If hoMenu begin |
||
320 | Broadcast Send Execute of hoMenu |
||
321 | End |
||
322 | |||
323 | // this activates all views from the report view menu |
||
324 | Get phoReportMenu to hoMenu |
||
325 | If hoMenu begin |
||
326 | Broadcast Send Execute of hoMenu |
||
327 | End |
||
328 | End_Procedure |
||
329 | |||
330 | // This checks all views within the client area to make sure that they fit within |
||
331 | // the client area. If not we will adjust the main panel so everything fits. This |
||
332 | // can only be done after the objects are all activated. |
||
333 | |||
334 | Procedure MakeGoodPanelSize |
||
335 | Handle hoView hoClient |
||
336 | Integer iSize iLoc iHeight iWidth iOldSize |
||
337 | Get Client_Id to hoClient |
||
338 | If hoClient begin |
||
339 | Get GuiSize of hoClient to iOldSize // starting size of client area |
||
340 | Move (Hi(iOldSize)) to iHeight |
||
341 | Move (Low(iOldSize)) to iWidth |
||
342 | // for each mdi client see if it fits, keep track of largest size needed |
||
343 | Get Next_Mdi_Dialog of hoClient True to hoView // find first |
||
344 | While (hoView) |
||
345 | Get GuiSize of hoView to iSize // size of view |
||
346 | Get GuiLocation of hoView to iLoc // location of view |
||
347 | Move (hi(iSize)+hi(iLoc)+10 max iHeight) to iHeight // max height needed (+10 is for wiggle room) |
||
348 | Move (low(iSize)+low(iLoc)+10 max iWidth) to iWidth // max width needed |
||
349 | Get Next_Mdi_Dialog of hoClient False to hoView // find next view |
||
350 | Loop |
||
351 | Move (iHeight-hi(iOldSize) max 0) to iHeight // get delta compared to old size. We want delta |
||
352 | Move (iWidth-low(iOldSize) max 0) to iWidth // only if the new size is bigger (i.e., > 0) |
||
353 | If (iHeight>0 or iWidth>0) begin |
||
354 | Get GuiSize to iOldSize // now add the delta to the panel size |
||
355 | Set GuiSize to (hi(iOldSize)+iHeight) (low(iOldSize)+iWidth) |
||
356 | Send Adjust_Logicals // adjust from gui to regular size |
||
357 | End |
||
358 | End |
||
359 | End_Procedure |
||
360 | |||
361 | // special test program augmentation which opens all views and report views and |
||
362 | // makes sure that the size of the panel is big enough |
||
363 | |||
364 | Procedure End_Construct_Object |
||
365 | Boolean bAutoActivate |
||
366 | Get Auto_Activate_State to bAutoActivate |
||
367 | Forward send End_Construct_Object |
||
368 | If bAutoActivate begin |
||
369 | Send AutoActivate // activate all views and report views |
||
370 | Send MakeGoodPanelSize // make sure the panel is big enough for all of this |
||
371 | End |
||
372 | End_Procedure |
||
373 | |||
374 | End_Object |
||
375 | |||
376 | Start_UI |