Main Menu

KB#00688-Status Bar Sample code

Title:

Status Bar Sample code

Description:

Program Sample for a Multi-Part Status Bar using the 'STATBAR' Mnemonic 


0010 OPEN (1)"X0" 
0020 PRINT (1)'WINDOW'(50,50,500,400,"Main",$00000803$,$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 the statusbar at control id 199 with the STATBAR parameters. This line also includes the initial text that will appear in the 'main' segment of the Status Bar. 

Line 60 defines the right margin for each section and in so doing also defines how many segments the status bar is divided into. After defining the placement of the right margins, use Sendmsg Function 27 to set them. (line 60 defines the right margin of each segment and line 70 sets the values) 

Based on the window width of 500, notice there are 4 - 2byte sections (line 60), the first segment is the end of the 'main' area of the status bar where the long cue will be displayed is set to the value (345,2). The 2nd segment is set to (395,2), the 3rd at (445,2) and the 4th at (495,2). 

SENDMSG function 20 sets the text to be in each segment. (Lines 80, 100, and 120) 

In order to find out how many segments the status bar is broken into you would use SENDMSG function 26. Using the above code: 

segs$=""; J=0 
parts$=sendmsg(1,199,26,J,segs$) 
print dec(parts$) 



is the correct return value. 



Last Modified: 08/10/1998 Product: Visual PRO/5 Operating System: N/A

BASIS structures five components of their technology into the BBx Generations.

  Google+ View BASIS LinkedIN ProfileVisit our Twitter Feed Check out our Facebook Public Profile Click to View the BASIS youTube channel