xref: /trunk/main/framework/test/test_statusindicatorfactory.bas (revision fc9fd3f14a55d77b35643a64034752a178b2a5b0)
1Sub Main
2
3    rem Get reference to current active frame. Most time this will be
4    rem the basic ide by himself.
5    xTestFrame = StarDesktop.ActiveFrame
6
7    rem Create more then one indicator objects for this frame.
8    xIndicator1 = xTestFrame.createStatusIndicator()
9    xIndicator2 = xTestFrame.createStatusIndicator()
10    xIndicator3 = xTestFrame.createStatusIndicator()
11
12    rem Check status of creation. No null references should be detected.
13    if( isNull(xIndicator1)=TRUE ) or ( isNull(xIndicator2)=TRUE ) or ( isNull(xIndicator3)=TRUE ) then
14        msgbox "Error: Could not create status indicators!"
15        exit Sub
16    endif
17
18    rem Start working for indicator 1 and 2.
19    rem The window should NOT be shown!
20    xIndicator1.start( "Indicator 1:", 100 )
21    xIndicator2.start( "Indicator 2:", 200 )
22    msgbox "Indicator 1 and 2 was started ... the window should NOT be shown!"
23
24    rem Start working for indicator 3.
25    rem The window should be shown! It's the most active one.
26    xIndicator3.start( "Indicator 3:", 300 )
27    msgbox "Indicator 3 was started ... the window should be shown!"
28
29    rem Set different values and texts for indicator 1 and 2.
30    rem These values are not visible.
31    xIndicator1.setValue( 25 )
32    xIndicator2.setValue( 50 )
33
34    rem Work with indicator 3.
35    rem If working finished automaticly indicator 2 is reactivated.
36    i = 0
37    while i<300
38        xIndicator3.setText( "Indicator 3: Range=300 Value=" + i )
39        xIndicator3.setValue( i )
40        i = i+10
41        wait( 1 )
42    wend
43
44    rem Delete indicator 2 before you deactivate number 3!
45    rem The next automaticly activated indicator will be the number 1.
46    xIndicator2.end
47    msgbox "Indicator 3 will be destroyed. Indicator 2 was deleted ... number 1 must reactivated automaticly!"
48    xIndicator3.end
49
50    rem Work with indicator 1.
51    rem If working finished automaticly the window will be destroyed.
52    i = 25
53    while i<100
54        xIndicator1.setText( "Indicator 1: Range=100 Value=" + i )
55        xIndicator1.setValue( i )
56        i = i+10
57        wait( 1 )
58    wend
59    xIndicator1.setText( "Indicator 1: ... reset values to defaults" )
60    wait( 1000 )
61    xIndicator1.reset
62    xIndicator1.setText( "Indicator 1: ... set 50 % for progress" )
63    wait( 1000 )
64    xIndicator1.setValue( 50 )
65    msgbox "Indicator 1 will be destroyed. Indicator window must destroyed automaticly!"
66    xIndicator1.end
67
68    msgbox "Test for status indicator finished successful!"
69End Sub
70