xref: /AOO42X/main/framework/test/test_statusindicatorfactory.bas (revision 2823505da2c122121568c8f40f2e319a42426ed8)
15b501c92SAndrew Ristrem *************************************************************
25b501c92SAndrew Ristrem
35b501c92SAndrew Ristrem  Licensed to the Apache Software Foundation (ASF) under one
45b501c92SAndrew Ristrem  or more contributor license agreements.  See the NOTICE file
55b501c92SAndrew Ristrem  distributed with this work for additional information
65b501c92SAndrew Ristrem  regarding copyright ownership.  The ASF licenses this file
75b501c92SAndrew Ristrem  to you under the Apache License, Version 2.0 (the
85b501c92SAndrew Ristrem  "License"); you may not use this file except in compliance
95b501c92SAndrew Ristrem  with the License.  You may obtain a copy of the License at
105b501c92SAndrew Ristrem
115b501c92SAndrew Ristrem    http://www.apache.org/licenses/LICENSE-2.0
125b501c92SAndrew Ristrem
135b501c92SAndrew Ristrem  Unless required by applicable law or agreed to in writing,
145b501c92SAndrew Ristrem  software distributed under the License is distributed on an
155b501c92SAndrew Ristrem  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165b501c92SAndrew Ristrem  KIND, either express or implied.  See the License for the
175b501c92SAndrew Ristrem  specific language governing permissions and limitations
185b501c92SAndrew Ristrem  under the License.
195b501c92SAndrew Ristrem
205b501c92SAndrew Ristrem *************************************************************
21cdf0e10cSrcweirSub Main
22cdf0e10cSrcweir
23cdf0e10cSrcweir    rem Get reference to current active frame. Most time this will be
24cdf0e10cSrcweir    rem the basic ide by himself.
25cdf0e10cSrcweir    xTestFrame = StarDesktop.ActiveFrame
26cdf0e10cSrcweir
27cdf0e10cSrcweir    rem Create more then one indicator objects for this frame.
28cdf0e10cSrcweir    xIndicator1 = xTestFrame.createStatusIndicator()
29cdf0e10cSrcweir    xIndicator2 = xTestFrame.createStatusIndicator()
30cdf0e10cSrcweir    xIndicator3 = xTestFrame.createStatusIndicator()
31cdf0e10cSrcweir
32cdf0e10cSrcweir    rem Check status of creation. No null references should be detected.
33cdf0e10cSrcweir    if( isNull(xIndicator1)=TRUE ) or ( isNull(xIndicator2)=TRUE ) or ( isNull(xIndicator3)=TRUE ) then
34cdf0e10cSrcweir        msgbox "Error: Could not create status indicators!"
35cdf0e10cSrcweir        exit Sub
36cdf0e10cSrcweir    endif
37cdf0e10cSrcweir
38cdf0e10cSrcweir    rem Start working for indicator 1 and 2.
39cdf0e10cSrcweir    rem The window should NOT be shown!
40cdf0e10cSrcweir    xIndicator1.start( "Indicator 1:", 100 )
41cdf0e10cSrcweir    xIndicator2.start( "Indicator 2:", 200 )
42cdf0e10cSrcweir    msgbox "Indicator 1 and 2 was started ... the window should NOT be shown!"
43cdf0e10cSrcweir
44cdf0e10cSrcweir    rem Start working for indicator 3.
45cdf0e10cSrcweir    rem The window should be shown! It's the most active one.
46cdf0e10cSrcweir    xIndicator3.start( "Indicator 3:", 300 )
47cdf0e10cSrcweir    msgbox "Indicator 3 was started ... the window should be shown!"
48cdf0e10cSrcweir
49cdf0e10cSrcweir    rem Set different values and texts for indicator 1 and 2.
50cdf0e10cSrcweir    rem These values are not visible.
51cdf0e10cSrcweir    xIndicator1.setValue( 25 )
52cdf0e10cSrcweir    xIndicator2.setValue( 50 )
53cdf0e10cSrcweir
54cdf0e10cSrcweir    rem Work with indicator 3.
55*07a3d7f1SPedro Giffuni    rem If working finished automatically indicator 2 is reactivated.
56cdf0e10cSrcweir    i = 0
57cdf0e10cSrcweir    while i<300
58cdf0e10cSrcweir        xIndicator3.setText( "Indicator 3: Range=300 Value=" + i )
59cdf0e10cSrcweir        xIndicator3.setValue( i )
60cdf0e10cSrcweir        i = i+10
61cdf0e10cSrcweir        wait( 1 )
62cdf0e10cSrcweir    wend
63cdf0e10cSrcweir
64cdf0e10cSrcweir    rem Delete indicator 2 before you deactivate number 3!
65*07a3d7f1SPedro Giffuni    rem The next automatically activated indicator will be the number 1.
66cdf0e10cSrcweir    xIndicator2.end
67*07a3d7f1SPedro Giffuni    msgbox "Indicator 3 will be destroyed. Indicator 2 was deleted ... number 1 must reactivated automatically!"
68cdf0e10cSrcweir    xIndicator3.end
69cdf0e10cSrcweir
70cdf0e10cSrcweir    rem Work with indicator 1.
71*07a3d7f1SPedro Giffuni    rem If working finished automatically the window will be destroyed.
72cdf0e10cSrcweir    i = 25
73cdf0e10cSrcweir    while i<100
74cdf0e10cSrcweir        xIndicator1.setText( "Indicator 1: Range=100 Value=" + i )
75cdf0e10cSrcweir        xIndicator1.setValue( i )
76cdf0e10cSrcweir        i = i+10
77cdf0e10cSrcweir        wait( 1 )
78cdf0e10cSrcweir    wend
79cdf0e10cSrcweir    xIndicator1.setText( "Indicator 1: ... reset values to defaults" )
80cdf0e10cSrcweir    wait( 1000 )
81cdf0e10cSrcweir    xIndicator1.reset
82cdf0e10cSrcweir    xIndicator1.setText( "Indicator 1: ... set 50 % for progress" )
83cdf0e10cSrcweir    wait( 1000 )
84cdf0e10cSrcweir    xIndicator1.setValue( 50 )
85*07a3d7f1SPedro Giffuni    msgbox "Indicator 1 will be destroyed. Indicator window must destroyed automatically!"
86cdf0e10cSrcweir    xIndicator1.end
87cdf0e10cSrcweir
88cdf0e10cSrcweir    msgbox "Test for status indicator finished successful!"
89cdf0e10cSrcweirEnd Sub
90