sync master with lastest vba changes
[ooovba.git] / testautomation / dbaccess / tools / controltools.inc
blobb49ebfea7ec45f1bbbfd7894094fc8d4619e33b2
1 'encoding UTF-8  Do not remove or change this line!
2 '**************************************************************************
3 '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 '* 
5 '* Copyright 2008 by Sun Microsystems, Inc.
6 '*
7 '* OpenOffice.org - a multi-platform office productivity suite
8 '*
9 '* $RCSfile: controltools.inc,v $
11 '* $Revision: 1.1.68.1 $
13 '* last change: $Author: msc $ $Date: 2008/10/28 07:52:48 $
15 '* This file is part of OpenOffice.org.
17 '* OpenOffice.org is free software: you can redistribute it and/or modify
18 '* it under the terms of the GNU Lesser General Public License version 3
19 '* only, as published by the Free Software Foundation.
21 '* OpenOffice.org is distributed in the hope that it will be useful,
22 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
23 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24 '* GNU Lesser General Public License version 3 for more details
25 '* (a copy is included in the LICENSE file that accompanied this code).
27 '* You should have received a copy of the GNU Lesser General Public License
28 '* version 3 along with OpenOffice.org.  If not, see
29 '* <http://www.openoffice.org/license.html>
30 '* for a copy of the LGPLv3 License.
32 '/************************************************************************
34 '* owner : marc.neumann@sun.com
36 '* short description : Helper Routines for Form and Control Tests
38 '***************************************************************************************
40 ' #1 fSwitchAutopilotOff
41 ' #1 fSetControlProperty
42 ' #1 fGetControlProperty
43 ' #1 hDrawingWithSelection 
44 ' #1 fOpenControlPropertyBrowser
45 ' #1 addControl
46 ' #1 fSwitchControlDesignMode
47 ' #1 closePropertyBrowserAndDocument
48 ' #1 fOpenMoreControlsToolBar
50 '\**************************************************************************************
53 function fSwitchAutopilotOff(SwitchAutoOff as boolean)
54     '/// turn the Control autopilots off or on
55     '/// <u>parameter:</u>
56     '/// <b>SwitchAutoOff:</b> If true the autopilot is turned off, if the parameter is false the autopilot is turned on
57                 
58     '/// open a new document
59     printlog "open a new document"
60     gApplication = "Writer"
61         call hNewDocument
62     Kontext "DocumentWriter"       
63         DocumentWriter.TypeKeys "tt_doc" , true
64         sleep(1)
65     Kontext "Toolbar"
66         call hToolbarSelect("FormControls",true)
67         Kontext "FormControls"          
68     '/// insert a group box to activate autopilot button
69         ListBox.Click
70         sleep(1)      
71     call hDrawingWithSelection ( 50, 50, 60, 60 )
72         sleep(2)
73     '/// check if auto pilot dialog is available
74     Kontext "AutoPilotListComboBox"
75     if AutoPilotListComboBox.Exists(3) then
76         Kontext "AutoPilotListComboBox"
77         AutoPilotListComboBox.Cancel
78         sleep(2)
79         if SwitchAutoOff = true then
80             Kontext "FormControls" 
81             printlog "switch autopilot off"     
82             UseWizards.Click
83             sleep(2)
84         else 
85             printlog "let autopilot on"
86         endif
87     else
88         if SwitchAutoOff = false then
89             Kontext "FormControls" 
90             printlog "switch autopilot on"      
91             UseWizards.Click
92             sleep(2)
93         else 
94             printlog "let autopilot off"
95         endif
96     endif       
97     hCloseDocument
98 end function
99 '--------------------------------------------------------------------------------------
100 function fSetControlProperty(sControlType, sPropertyName, sPropertyValue as string)
101         '/// set the property of a control via the control property browser    
102     '/// <u>parameter:</u>
103     '/// <b>sControlType:</b> The name of the control type f.e. TextBox
104     '/// <b>sPropertyName:</b> The name of the control property f.e. DefaultValue
105     '/// <b>sPropertyValue:</b> The value of the control property    
106     
107     ' switch to the General Page
108     Kontext "ControlPropertiesTabControl"
109         ControlPropertiesTabControl.setPage TabGeneralControl 
111     Kontext "TabGeneralControl" 
112     if TabGeneralControl.exists(3) then        
113         printlog "Set Property '" + sPropertyName + "' to the value '" + sPropertyValue + "' for a '" + sControlType + "' control."   
114         ' A - C
115                 
116                 if sPropertyName = "Accuracy" then
117                     Accuracy.setText(sPropertyValue)
118                 elseif sPropertyName = "Align" then        
119                     Align.select(Cint(sPropertyValue))
120                 elseif sPropertyName = "AdditionalInfo" then
121                     Information.setText(sPropertyValue)
122                 elseif sPropertyName = "AutoComplete" then
123                     AutoComplete.select(Cint(sPropertyValue))
124                 elseif sPropertyName = "Background" then
125                     Background.select(Cint(sPropertyValue))
126                 elseif sPropertyName = "Border" then
127                     Border.select(Cint(sPropertyValue))
128                 elseif sPropertyName = "BorderColor" then
129                     BorderColor.select(Cint(sPropertyValue))
130                 elseif sPropertyName = "ButtonType" then
131                     ButtonType.select(Cint(sPropertyValue))
132                 elseif sPropertyName = "BlockIncrement" then
133                     BlockIncrement.setText(sPropertyValue)
134                 elseif sPropertyName = "CellBound" then
135                     Kontext "ControlPropertiesTabControl"
136                         ControlPropertiesTabControl.setPage TabDataControl
137                     Kontext "TabDataControl"
138                         CellBound.setText(sPropertyValue)
139                         CellBound.typeKeys("<RETURN>",true)
140                     Kontext "ControlPropertiesTabControl"
141                         ControlPropertiesTabControl.setPage TabGeneralControl
142                 elseif sPropertyName = "CellRange" then
143                     Kontext "ControlPropertiesTabControl"
144                         ControlPropertiesTabControl.setPage TabDataControl
145                     Kontext "TabDataControl"
146                         CellRange.setText(sPropertyValue)
147                         CellRange.typeKeys("<RETURN>",true)
148                     Kontext "ControlPropertiesTabControl"
149                         ControlPropertiesTabControl.setPage TabGeneralControl
150                 elseif sPropertyName = "CurrSymPosition" then
151                     CurrSymPosition.select(Cint(sPropertyValue))
152                 elseif sPropertyName = "CurrencySymbol" then
153                     CurrencySymbol.setText(sPropertyValue)
154             
155         'D - F
156         
157                 elseif sPropertyName = "DateMax" then
158                     DateMax.setText(sPropertyValue)
159                 elseif sPropertyName = "DateMin" then
160                     DateMin.setText(sPropertyValue)
161                 elseif sPropertyName = "DateFormat" then
162                     DateFormat.select(Cint(sPropertyValue))
163                 elseif sPropertyName = "DefaultButton" then
164                     DefaultButton.select(Cint(sPropertyValue))
165                 elseif sPropertyName = "DefaultSelection2" then
166                     DefaultSelection2.setText(sPropertyValue)
167                 elseif sPropertyName = "DefaultState" then
168                     DefaultState.select(Cint(sPropertyValue))
169                 elseif sPropertyName = "DefaultValue" then                    
170                     TabGeneralControl.MouseDown 1,1,1,true
171                     sleep(1)
172                     TabGeneralControl.TypeKeys "<TAB>" , 11 , true
173                     sleep(1)
174                     TabGeneralControl.TypeKeys sPropertyValue , true                    
175                     sleep(1)
176                     TabGeneralControl.TypeKeys "<RETURN>" , true
177                     sleep(1)
178                 elseif sPropertyName = "Delay" then
179                     Delay.setText(sPropertyValue)
180                 elseif sPropertyName = "DropDown" then
181                     DropDown.select(Cint(sPropertyValue))
182                 elseif sPropertyName = "Enabled" then
183                     Enabled.select(Cint(sPropertyValue))
184                 elseif sPropertyName = "EditMask" then
185                     EditMask.setText(sPropertyValue)    
186                 elseif sPropertyName = "FilteringSorting" then
187                     FilteringSorting.select(Cint(sPropertyValue))
188                 elseif sPropertyName = "Frame" then
189                     Frame.select(Cint(sPropertyValue))
190         
191         'G - L
192         
193                 elseif sPropertyName = "Graphics" then
194                     Graphics.setText(sPropertyValue)  
195                 elseif sPropertyName = "GraphicsAlignment" then
196                     GraphicsAlignment.select(Cint(sPropertyValue))
197                 elseif sPropertyName = "HelpText" then
198                     HelpText.setText(sPropertyValue)
199                 elseif sPropertyName = "HelpURL" then
200                     HelpURL.setText(sPropertyValue)
201                     HelpURL.TypeKeys "<RETURN>",true
202                 elseif sPropertyName = "HiddenValue" then
203                     HiddenValue.setText(sPropertyValue)
204                 elseif sPropertyName = "HideSelection" then
205                     HideSelection.select(Cint(sPropertyValue))
206                 elseif sPropertyName = "IconSize" then
207                     IconSize.select(Cint(sPropertyValue))
208                 elseif sPropertyName = "LineCount" then
209                      LineCount.setText(sPropertyValue) 
210                 elseif sPropertyName = "LineIncrement" then
211                     LineIncrement.setText(sPropertyValue)
212                 elseif sPropertyName = "LiteralMask" then
213                     LiteralMask.setText(sPropertyValue)
214                 elseif sPropertyName = "ListEntries" then
215                     ListEntries.setText(sPropertyValue)
216             
217         'M - O
218          
219                 elseif sPropertyName = "MaxTextLen" then
220                      MaxTextLen.setText(sPropertyValue)
221                 elseif sPropertyName = "MultiLine" then
222                     qaerrorlog "The Property MultiLine doesn't exists anymore."
223                     qaerrorlog "Please use TextType instead. This property will be removed soon."
224                     TextType.select(Cint(sPropertyValue))
225                 elseif sPropertyName = "MultiLine2" then
226                     MultiLine.select(Cint(sPropertyValue))
227                 elseif sPropertyName = "Multiselection" then
228                     Multiselection.select(Cint(sPropertyValue))
229                 elseif sPropertyName = "NameText" then
230                     NameText.setText(sPropertyValue)
231                     NameText.typeKeys("<RETURN>",true)
232                 elseif sPropertyName = "Navigation" then
233                     Navigation.select(Cint(sPropertyValue))
234                 elseif sPropertyName = "NavigationBar" then
235                     NavigationBar.select(Cint(sPropertyValue))            
236                 elseif sPropertyName = "Orientation" then
237                     Orientation.select(Cint(sPropertyValue))
238                 elseif sPropertyName = "Order" then
239                     Order.setText(sPropertyValue)
240             
241         'P - R
242         
243                 elseif sPropertyName = "Password" then
244                     Password.setText(sPropertyValue)
245                 elseif sPropertyName = "ReferenceValue" then
246                     Kontext "ControlPropertiesTabControl"
247                         ControlPropertiesTabControl.setPage TabDataControl
248                     Kontext "TabDataControl"
249                         ReferenceValue.setText(sPropertyValue)
250                     Kontext "ControlPropertiesTabControl"
251                         ControlPropertiesTabControl.setPage TabGeneralControl
252                 elseif sPropertyName = "Repeat" then
253                     Repeat.select(Cint(sPropertyValue))
254                 elseif sPropertyName = "Printable" then
255                     Printable.select(Cint(sPropertyValue))
256                 elseif sPropertyName = "Positioning" then
257                     Positioning.select(Cint(sPropertyValue))
258                 elseif sPropertyName = "RecordActions" then
259                     RecordActions.select(Cint(sPropertyValue))    
260                 elseif sPropertyName = "RecordMarker" then
261                     RecordMarker.select(Cint(sPropertyValue))
262                 elseif sPropertyName = "ReferenceValueOff" then
263                     Kontext "ControlPropertiesTabControl"
264                         ControlPropertiesTabControl.setPage TabDataControl
265                     Kontext "TabDataControl"
266                         ReferenceValueOff.setText(sPropertyValue)
267                     Kontext "ControlPropertiesTabControl"
268                         ControlPropertiesTabControl.setPage TabGeneralControl
269                 elseif sPropertyName = "Readonly" then
270                     Readonly.select(Cint(sPropertyValue))    
271                 elseif sPropertyName = "RowHeight" then
272                     RowHeight.setText(sPropertyValue)
273             
274         'S
275         
276                 elseif sPropertyName = "Scale" then
277                     Scale.select(Cint(sPropertyValue))
278                 elseif sPropertyName = "Spin" then            
279                     Spin.select(CInt(sPropertyValue))
280                 elseif sPropertyName = "StrictFormat" then            
281                     StrictFormat.select(CInt(sPropertyValue))
282                 elseif sPropertyName = "Scrollbars" then
283                     Scrollbars.select(Cint(sPropertyValue))
284                 elseif sPropertyName = "SymbolColor" then
285                     SymbolColor.select(Cint(sPropertyValue))        
286                 elseif sPropertyName = "TextType" then
287                     TextType.select(Cint(sPropertyValue))
288                 elseif sPropertyName = "ScrollValueMin" then
289                     ScrollValueMin.setText(sPropertyValue) 
290                 elseif sPropertyName = "ScrollValueMax" then
291                     ScrollValueMax.setText(sPropertyValue)
292                 elseif sPropertyName = "ScrollValueDefault" then
293                     ScrollValueDefault.setText(sPropertyValue)        
294         
295         'T - U
296         
297                 elseif sPropertyName = "TabOrder" then            
298                     Order.setText(sPropertyValue)
299                     TabGeneralControl.TypeKeys "<RETURN>",true
300                 elseif sPropertyName = "TabStop" then            
301                     TabStop.select(Cint(sPropertyValue))
302                 elseif sPropertyName = "TakeFocus" then            
303                     TakeFocus.select(Cint(sPropertyValue))
304                 elseif sPropertyName = "TextType" then            
305                     TextType.select(Cint(sPropertyValue))
306                 elseif sPropertyName = "ThousandSeperator" then            
307                     ThousandSeperator.select(CInt(sPropertyValue))
308                 elseif sPropertyName = "TimeFormat" then
309                     TimeFormat.select(Cint(sPropertyValue))
310                 elseif sPropertyName = "TimeMax" then
311                     TimeMax.setText(sPropertyValue)
312                 elseif sPropertyName = "TimeMin" then
313                     TimeMin.setText(sPropertyValue)
314                 elseif sPropertyName = "ToggleProp" then
315                     ToggleProp.select(Cint(sPropertyValue))
316                 elseif sPropertyName = "TriState" then
317                     TriState.select(Cint(sPropertyValue))
318                 elseif sPropertyName = "URL" then        
319                     URL.setText(sPropertyValue)
320             
321         'V - Z
322         
323                 elseif sPropertyName = "VisibleSize" then
324                     VisibleSize.setText(sPropertyValue)
325                 elseif sPropertyName = "ValueMin" then
326                     if sControlType = "FormattedField" then
327                         EffectiveMin.setText(sPropertyValue)
328                     else
329                         ValueMin.setText(sPropertyValue)
330                     endif
331                 elseif sPropertyName = "ValueMax" then
332                     if sControltype = "FormattedField" then
333                         EffectiveMax.setText(sPropertyValue)
334                     else
335                         ValueMax.setText(sPropertyValue)
336                     endif
337                 elseif sPropertyName = "ValueStep" then
338                     ValueStep.setText(sPropertyValue)
339         '        
340                 else
341                     warnlog "The property " + sPropertyName + " doesn't exists in the function fSetControlProperty."
342                     warnlog "Please add it to the function in dbaccess/tools/controltools.inc."          
343                 endif
344         
345         'need additional return
346         sleep(1)
347         TabGeneralControl.TypeKeys "<RETURN>",true
348     else
349         warnlog "The control property browser doesn't exists."
350     endif
351     sleep(1)
352 end function
353 '--------------------------------------------------------------------------------------
354 function fGetControlProperty(sControlType,sPropertyName)
355         '/// get the property of a control from the control property browser    
356     '/// <u>parameter:</u>
357     '/// <b>sControlType:</b> The name of the control type f.e. TextBox
358     '/// <b>sPropertyName:</b> The name of the control property f.e. DefaultValue
359             
360     Dim sReturn as String
362     ' switch to the General Page
363     Kontext "ControlPropertiesTabControl"
364         ControlPropertiesTabControl.setPage TabGeneralControl
366     Kontext "TabGeneralControl" 
367     if TabGeneralControl.exists(3) then
368         
369     ' A - C
370         
371         if sPropertyName = "Accuracy" then
372             sReturn = Accuracy.getSelIndex
373         elseif sPropertyName = "AdditionalInfo" then
374             sReturn = Information.getText
375         elseif sPropertyName = "Align" then
376             sReturn = Align.getSelIndex 
377         elseif sPropertyName = "AutoComplete" then
378             sReturn = AutoComplete.getSelIndex   
379         elseif sPropertyName = "Background" then
380             sReturn = Background.getSelIndex
381         elseif sPropertyName = "BlockIncrement" then
382             sReturn = BlockIncrement.getText
383         elseif sPropertyName = "Border" then
384             sReturn = Border.getSelIndex
385         elseif sPropertyName = "BorderColor" then
386             sReturn = BorderColor.getSelIndex
387         elseif sPropertyName = "ButtonType" then
388             sReturn = ButtonType.getSelIndex
389         elseif sPropertyName = "CellBound" then
390             Kontext "ControlPropertiesTabControl"
391                 ControlPropertiesTabControl.setPage TabDataControl
392             Kontext "TabDataControl"                
393                 sReturn = CellBound.getText()                
394             Kontext "ControlPropertiesTabControl"
395                 ControlPropertiesTabControl.setPage TabGeneralControl
396         elseif sPropertyName = "CellRange" then
397             Kontext "ControlPropertiesTabControl"
398                 ControlPropertiesTabControl.setPage TabDataControl
399             Kontext "TabDataControl"                
400                 sReturn = CellRange.getText()                
401             Kontext "ControlPropertiesTabControl"
402                 ControlPropertiesTabControl.setPage TabGeneralControl
403         elseif sPropertyName = "CurrSymPosition" then
404             sReturn = CurrSymPosition.getSelIndex
405         elseif sPropertyName = "CurrencySymbol" then
406             sReturn = CurrencySymbol.getText
407             
408     'D - F
409             
410         elseif sPropertyName = "DateMax" then
411             sReturn = DateMax.getText
412         elseif sPropertyName = "DateMin" then
413             sReturn = DateMin.getText    
414         elseif sPropertyName = "DateFormat" then
415             sReturn = DateFormat.getSelIndex
416         elseif sPropertyName = "DefaultButton" then
417             sReturn = DefaultButton.getSelIndex
418         elseif sPropertyName = "Delay" then
419             sReturn = Delay.getText
420         elseif sPropertyName = "DefaultState" then
421             sReturn = DefaultState.getSelIndex
422         elseif sPropertyName = "DefaultSelection2" then
423             sReturn = DefaultSelection2.getText
424         elseif sPropertyName = "DefaultValue" then
425             sReturn = DefaultValue.getText
426         elseif sPropertyName = "DropDown" then
427             sReturn = DropDown.getSelIndex
428         elseif sPropertyName = "EditMask" then
429             sReturn = EditMask.getText
430         elseif sPropertyName = "Enabled" then
431             sReturn = Enabled.getSelIndex
432         elseif sPropertyName = "FilteringSorting" then
433             sReturn = FilteringSorting.getSelIndex
434         elseif sPropertyName = "Formatkey" then
435             sReturn = Formatkey.getText
436         elseif sPropertyName = "Frame" then
437             sReturn = Frame.getSelIndex
438             
439     'G - L
440             
441         elseif sPropertyName = "Graphics" then
442             sReturn = Graphics.getSelText
443         elseif sPropertyName = "GraphicsAlignment" then  
444             sReturn = GraphicsAlignment.getSelIndex
445         elseif sPropertyName = "HelpText" then
446             sReturn = HelpText.getText
447         elseif sPropertyName = "HelpURL" then
448             sReturn = HelpURL.getText
449         elseif sPropertyName = "HiddenValue" then
450             sReturn = HiddenValue.getText 
451         elseif sPropertyName = "HideSelection" then
452             sReturn = HideSelection.getSelIndex            
453         elseif sPropertyName = "IconSize" then
454             sReturn = IconSize.getSelIndex
455         elseif sPropertyName = "LineCount" then
456             sReturn = LineCount.getText
457         elseif sPropertyName = "LineIncrement" then
458             sReturn = LineIncrement.getText
459         elseif sPropertyName = "LiteralMask" then
460             sReturn = LiteralMask.getText
461         elseif sPropertyName = "ListEntries" then  
462             sReturn = ListEntries.getText
463         
464     'M - O
465         
466         elseif sPropertyName = "MaxTextLen" then
467             sReturn = MaxTextLen.getText
468         elseif sPropertyName = "MultiLine" then
469             sReturn = MultiLine.getSelIndex
470         elseif sPropertyName = "MultiLine2" then
471             sReturn = MultiLine.getSelIndex
472         elseif sPropertyName = "Multiselection" then
473             sReturn = Multiselection.getSelIndex
474         elseif sPropertyName = "NameText" then
475             sReturn = NameText.getText
476         elseif sPropertyName = "Navigation" then
477             sReturn = Navigation.getSelIndex
478         elseif sPropertyName = "NavigationBar" then
479             sReturn = NavigationBar.getSelIndex
480         elseif sPropertyName = "Order" then
481             sReturn = Order.getText
482         elseif sPropertyName = "Orientation" then
483             sReturn = Orientation.getSelIndex        
484          
485     'P - R
486         
487         elseif sPropertyName = "Password" then
488             sReturn = Password.getText
489         elseif sPropertyName = "Positioning" then
490             sReturn = Positioning.getSelIndex
491         elseif sPropertyName = "Printable" then
492             sReturn = Printable.getSelIndex
493         elseif sPropertyName = "Readonly" then
494             sReturn = Readonly.getSelIndex
495         elseif sPropertyName = "RecordActions" then
496             sReturn = RecordActions.getSelIndex
497         elseif sPropertyName = "RecordMarker" then
498             sReturn = RecordMarker.getSelIndex
499         elseif sPropertyName = "ReferenceValue" then
500             Kontext "ControlPropertiesTabControl"
501                 ControlPropertiesTabControl.setPage TabDataControl
502             Kontext "TabDataControl"
503                 sReturn = ReferenceValue.getText
504             Kontext "ControlPropertiesTabControl"
505                 ControlPropertiesTabControl.setPage TabGeneralControl
506         elseif sPropertyName = "Repeat" then
507             sReturn = Repeat.getSelIndex  
508         elseif sPropertyName = "RowHeight" then
509             sReturn = RowHeight.getText
510     
511     'S
512         
513         elseif sPropertyName = "Scale" then
514             sReturn = Scale.getSelIndex
515         elseif sPropertyName = "Scrollbars" then
516             sReturn = Scrollbars.getSelIndex
517         elseif sPropertyName = "ScrollValueDefault" then
518             sReturn = ScrollValueDefault.getText
519         elseif sPropertyName = "ScrollValueMax" then
520             sReturn = ScrollValueMax.getText
521         elseif sPropertyName = "ScrollValueMin" then
522             sReturn = ScrollValueMin.getText
523         elseif sPropertyName = "Spin" then
524             sReturn = Spin.getSelIndex
525         elseif sPropertyName = "StrictFormat" then
526             sReturn = StrictFormat.getSelIndex
527         elseif sPropertyName = "SymbolColor" then
528             sReturn = SymbolColor.getSelIndex
529         
530     'T - U
531         
532         elseif sPropertyName = "TabStop" then
533             sReturn = TabStop.getSelIndex
534         elseif sPropertyName = "TakeFocus" then
535             sReturn = TakeFocus.getSelIndex
536         elseif sPropertyName = "TextType" then            
537             sReturn = TextType.getSelIndex
538         elseif sPropertyName = "ThousandSeperator" then
539             sReturn = ThousandSeperator.getSelIndex
540         elseif sPropertyName = "TimeFormat" then
541             sReturn = TimeFormat.getSelIndex
542         elseif sPropertyName = "TimeMax" then
543             sReturn = TimeMax.getText
544         elseif sPropertyName = "TimeMin" then
545             sReturn = TimeMin.getText
546         elseif sPropertyName = "ToggleProp" then  
547             sReturn = ToggleProp.getSelIndex
548         elseif sPropertyName = "TriState" then
549             sReturn = TriState.getSelIndex
550     
551     'V - Z
552     
553         elseif sPropertyName = "ValueMin" then
554             if sControlType = "FormattedField" then
555                 sReturn = EffectiveMin.getText
556             else
557                 sReturn = ValueMin.getText
558             endif
559         elseif sPropertyName = "ValueMax" then
560             if sControltype = "FormattedField" then
561                 sReturn = EffectiveMax.getText
562             else
563                 sReturn = ValueMax.getText
564             endif
565         elseif sPropertyName = "VisibleSize" then
566             sReturn = VisibleSize.getText
567         elseif sPropertyName = "ValueStep" then
568             sReturn = ValueStep.getText
569             
570         endif
571     else
572         warnlog "The control property browser doesn't exists."
573     endif
574     fGetControlProperty = sReturn
575 end function
576 '--------------------------------------------------------------------------------------
577 sub hDrawingWithSelection ( iStartX, iStartY, iEndX, iEndY )
578     '/// move the mouse with pressed mouse button      
579     '/// <u>parameter:</u>
580     '/// <b>iStartX:</b> The x start coordinate
581     '/// <b>iStartY:</b> The y start coordinate
582     '/// <b>iEndX:</b> The x end coordinate
583     '/// <b>iEndY:</b> The x end coordinate
585    select case gApplication
587       case "CALC"        : Kontext "DocumentCalc"
588                             DocumentCalc.MouseDown ( iStartX, iStartY )
589                             DocumentCalc.MouseMove ( iEndX, iEndY )
590                             DocumentCalc.MouseUp ( iEndX, iEndY )
592       case "WRITER"      : Kontext "DocumentWriter"
593                             DocumentWriter.MouseDown ( iStartX, iStartY )
594                             DocumentWriter.MouseMove ( iEndX, iEndY )
595                             DocumentWriter.MouseUp ( iEndX, iEndY )
597       case "HTMLDOKUMENT": Kontext "DocumentWriterWeb"
598                             DocumentWriterWeb.MouseDown ( iStartX, iStartY )
599                             DocumentWriterWeb.MouseMove ( iEndX, iEndY )
600                             DocumentWriterWeb.MouseUp ( iEndX, iEndY )
602       case "GLOBALDOC"   : Kontext "DocumentMasterDoc"
603                             DocumentMasterDoc.MouseDown ( iStartX, iStartY )
604                             DocumentMasterDoc.MouseMove ( iEndX, iEndY )
605                             DocumentMasterDoc.MouseUp ( iEndX, iEndY )
607       case "IMPRESS"     : Kontext "DocumentImpress"
608                             DocumentImpress.MouseDown ( iStartX, iStartY )
609                             DocumentImpress.MouseMove ( iEndX, iEndY )
610                             DocumentImpress.MouseUp ( iEndX, iEndY )
612       case "DRAW"        : Kontext "DocumentDraw"
613                             DocumentDraw.MouseDown ( iStartX, iStartY )
614                             DocumentDraw.MouseMove ( iEndX, iEndY )
615                             DocumentDraw.MouseUp ( iEndX, iEndY )
617    end select
618 end sub
619 '--------------------------------------------------------------------------------------
620 function fOpenControlPropertyBrowser
621     '/// open the Control Properties Dialog      
622     '/// <u>parameter:</u>
623     '/// <u>return:</u>    
624     sleep(2)
626     call hToolbarSelect("FormControls",true)    
628     Kontext "FormControls"
629         ControlProperties.Click  
630     Kontext "ControlPropertiesDialog"
631     
632     if ControlPropertiesDialog.exists(3) then
633         'nothing
634     else
635        Kontext "FormControls"        
636             ControlProperties.Click    
637     endif
638         
639     sleep(2)
640     fOpenControlPropertyBrowser=true
641     
642 end function
643 '--------------------------------------------------------------------------------------
644 function addControl(sControl as String, isx as integer , isy as integer , iex as integer , iey as integer)
645     '/// add the specified control and the specified position      
646     '/// <u>parameter:</u>
647     '/// <b>sControl</b> the control name
648     '/// <b>isx</b> the start x coordinate
649     '/// <b>isy</b> the start y coordinate
650     '/// <b>iex</b> the end x coordinate
651     '/// <b>iey</b> the end y coordinate
652     '/// <u>return:</u>
654     dim oControl as Object
655         
656     if sControl = "SpinButton" then
657     
658         call hToolbarSelect("MoreControls",true)            
659         Kontext "MoreControls"  
660             SpinButton.Click        
662     elseif sControl = "ScrollBar" then
663     
664         call hToolbarSelect("MoreControls",true)        
665         Kontext "MoreControls"  
666             Scrollbar.Click
667             
668     elseif sControl = "ImageButton" then
669     
670         call hToolbarSelect("MoreControls",true)
671         Kontext "MoreControls"  
672             ImageButton.Click
673             
674     elseif sControl = "ImageControl" then
675            
676         call hToolbarSelect("MoreControls",true)
677         Kontext "MoreControls"  
678             ImageControl.Click
679             
680     elseif sControl = "FileControl" then
681         
682         call hToolbarSelect("MoreControls",true)
683         Kontext "MoreControls"  
684             FileControl.Click
685             
686     elseif sControl = "DateField" then
687            
688         call hToolbarSelect("MoreControls",true)       
689         Kontext "MoreControls"  
690             DateField.Click
691             
692     elseif sControl = "TimeField" then
693        
694         call hToolbarSelect("MoreControls",true)       
695         Kontext "MoreControls"  
696             TimeField.Click
697                    
698     elseif sControl = "NumericField" then
699            
700         call hToolbarSelect("MoreControls",true)        
701         Kontext "MoreControls"  
702             Numericfield.Click
703             
704     elseif sControl = "CurrencyField" then
705            
706         call hToolbarSelect("MoreControls",true)        
707         Kontext "MoreControls"  
708             CurrencyField.Click
709             
710     elseif sControl = "PatternField" then
711            
712         call hToolbarSelect("MoreControls",true)        
713         Kontext "MoreControls"  
714             PatternField.Click
715             
716     elseif sControl = "GroupBox" then
717           
718         call hToolbarSelect("MoreControls",true)        
719         Kontext "MoreControls"  
720             GroupBox.Click
721             
722     elseif sControl = "Grid" then
723            
724         call hToolbarSelect("MoreControls",true)        
725         Kontext "MoreControls"  
726             Grid.Click
727             
728     elseif sControl = "NavigationBar" then
729            
730         call hToolbarSelect("MoreControls",true)        
731         Kontext "MoreControls"  
732             NavigationBar.Click
733             
734     elseif sControl = "Edit" then
735     
736         call hToolbarSelect("FormControls",true)        
737         Kontext "FormControls"  
738             Edit.Click            
740     elseif sControl = "Label" then
741     
742         call hToolbarSelect("FormControls",true)        
743         Kontext "FormControls"  
744             Label.Click
745    
746     elseif sControl = "CheckBox" then
747     
748         call hToolbarSelect("FormControls",true)        
749         Kontext "FormControls"  
750             CheckBox.Click
751             
752     elseif sControl = "FormattedField" then
753     
754         call hToolbarSelect("FormControls",true)        
755         Kontext "FormControls"  
756             FormattedField.Click
757    
758     elseif sControl = "PushButton" then
759     
760         call hToolbarSelect("FormControls",true)        
761         Kontext "FormControls"  
762             PushButton.Click 
763     
764     elseif sControl = "ListBox" then
765     
766         call hToolbarSelect("FormControls",true)        
767         Kontext "FormControls"  
768             ListBox.Click
769    
770     elseif sControl = "ComboBox" then
771     
772         call hToolbarSelect("FormControls",true)        
773         Kontext "FormControls"  
774             ComboBox.Click
775             
776     elseif sControl = "RadioButton" then
777     
778         call hToolbarSelect("FormControls",true)        
779         Kontext "FormControls"  
780             RadioButton.Click
781             
782     else
783         warnlog "control " + sControl + " not found. add to addControl in control tools."    
784     endif
785     sleep(1)
786     
787     call hDrawingWithSelection ( isx, isy, iex, iey )
788     
789     sleep(2)
790         
791     Kontext "FormControls"
792     
793 end Function
794 '--------------------------------------------------------------------------------------
795 function fSwitchControlDesignMode()
796     '/// switch the control design on or off
797     '/// <u>parameter:</u>
798     '/// <u>return:</u>
799     
800     Kontext "Toolbar"
801         call hToolbarSelect("FormControls",true)
802         sleep(1)
803         Kontext "FormControls"
804         SwitchControlDesignMode.Click
805         
806 end function
807 '--------------------------------------------------------------------------------------
808 function closePropertyBrowserAndDocument
809     '/// close control property browser and the document
810     '/// only used in the Control_Serveral tests
811     '/// <u>parameter:</u>
812     '/// <u>return:</u>
813     
814     printlog "close control property browser"    
815     Kontext "ControlPropertiesDialog"
816         ControlPropertiesDialog.close
817     '/// close document
818     printlog "close document"
819     hCloseDocument
820     
821 end function
822 '--------------------------------------------------------------------------------------
823 function fOpenMoreControlsToolBar
824     '/// open the More Controls toolbar      
825     '/// <u>parameter:</u>
826     '/// <u>return:</u>
827     Kontext "MoreControls"
828     if not MoreControls.exists(1) then
829         Kontext "FormControls"
830             MoreControls.Click
831         Kontext "MoreControls"    
832     endif   
833 End function