STATBAR Mnemonic - Create a Status Bar

Syntax

'STATBAR' (id,x,y,w,h,title,flags)

Description

The 'STATBAR' mnemonic creates a status bar. Status bars automatically locate themselves at the bottom of the window, so the x, y, w, and h parameters are always ignored.

Parameter Description
id Control ID number. It must be an integer between 1 and 32767 and be unique within a given top-level window.
x Ignored, but must be entered.
y Ignored, but must be entered.
w Ignored, but must be entered.
h Ignored, but must be entered.
title Title of the control.
flags Control flags, as follows:
FlagDescription
$0001$Sets the status bar to be initially disabled.
$0010$Sets the status bar to be initially invisible.
$0020$Displays the status bar on top of the window.
$2000$Left-justifies status bar text.
$4000$Centers status bar text.
$8000$Right-justifies status bar text.

In Visual PRO/5 2.x, the status bar control can be divided into a maximum of 255 segments, and each can contain left-justified, right-justified, or centered text. By default, the status bar contains a single segment that is left justified and works the original status bar control of Visual PRO/5 1.0. This initial segment or part is identified as part 0.

Text justification within a segment is achieved by using the tab character $09$. Text to the right of a single tab character is centered, and text to the right of a second-tab character is right aligned.

Status Bar SENDMSG() Functions are used to define the segments. Each segment's appearance can be controlled using the following attribute flags:

Attribute

Value

Description

No Border

$0100$

Segment has no border.

Pop Out

$0200$

Segment draws text with a border to appear higher than the plane of the window.

Right to left

$0400$

Segment displays text using right-to-left reading order for use on Hebrew or Arabic systems.

The CTRL() function returns information about status bars with the following parameters:

Function

Name

Description

CTRL(sysgui,id,1)

Get Text

Returns the text of the status bar.

CTRL(sysgui,id,7)

Get All Text

Returns the text of the status bar. The results are identical to those of function 1.

Example

The following creates a four-segment status bar:

0010 OPEN (1)"X0"
0020 PRINT (1)'WINDOW'(50,50,500,400,"Main",$0803$,$FFFFFFFF$)
0030 PRINT (1)'STATBAR'(199,0,0,0,0,"test",$8000$)
0040 PRINT (1)'BUTTON'(101,5,5,50,0,"Button",$$)
0050 PRINT (1)'CUE'(101,"Cue Text","Long Status text")
0060 LET S$=BIN(345,2)+BIN(395,2)+BIN(445,2)+BIN(495,2)
0070 LET PARTS$=SENDMSG(1,199,27,0,S$)
0080 LET TF$=SENDMSG(1,199,20,DEC($0001$),$09$+"First")
0090 PRINT HTA(TF$)
0100 LET TF$=SENDMSG(1,199,20,DEC($0002$),$09$+"Second")
0110 PRINT HTA(TF$)
0120 LET TF$=SENDMSG(1,199,20,DEC($0003$),$09$+"Third")
0130 PRINT HTA(TF$)
0140 ESCAPE

Line 30 initializes a status bar with a control ID of 199 and includes the initial text that will appear in the main segment. Line 60 defines the number of status bar segments and the right margin for each section. Based on the window width of 500, notice there are four two-byte sections. The first segment is the end of the 'main' area of the status bar where the long cue will be displayed and is set to the value (345,2). The second segment is set to (395,2), the third to (445,2) and the fourth to (495,2).

Line 70 uses SENDMSG() status bar function 27 to set the segments.

Lines 80, 100, and 120 use SENDMSG() status bar function 20 to set the text in the first, second, and third segment, respectively.

SENDMSG() status bar function 26 can be used to determine the number of status bar segments. For example, the following returns the value of 4 (status bar segments):

SEGS$=""; J=0
PARTS$=SENDMSG(1,199,26,J,SEGS$)
PRINT DEC(PARTS$)

See Also

Mnemonics - Alphabetical Listing

Mnemonics - Group Listing