Dec 152017
 
Status line object for Turbo Pascal. Requires Object Professional.
File STLIN1.ZIP from The Programmer’s Corner in
Category Pascal Source Code
Status line object for Turbo Pascal. Requires Object Professional.
File Name File Size Zip Size Zip Type
SL_TEST1.PAS 2013 793 deflated
SL_TEST2.PAS 2919 1205 deflated
SL_TEST3.PAS 2131 821 deflated
SL_TEST4.PAS 2011 809 deflated
STATLINE.DOC 5621 1746 deflated
STATLINE.PAS 7980 1886 deflated

Download File STLIN1.ZIP Here

Contents of the STATLINE.DOC file


STATLINE version 1.01

(C) Giuseppe Maxia 1991


purpose: create and handle a status line with flexible mouse interface

Author: Giuseppe Maxia
Compuserve: 10015,212
BIX : gmaxia

Released to public domain 1991

Requirements: Turbo Pascal 5.5 / 6.0
Object professional 1.x


Reference Guide

StatLine exports a simple object that allow you to create, display, hide,
manage a single or multiple status line.

---------------------------------------------------------------------------
WARNING!
StatusLine dos not recognize window limits of any other object in the
screen. It's programmer's responsability to design statusline out of space
used by windows

---------------------------------------------------------------------------
StatusLine.Init

declaration
constructor Init( MinR, MaxR: byte; FA : FlexAttr);

purpose
initialize status line object, allocate space for screen line(s) and
clear them.

description
MinR is the minimum Row of Status Line
MaxR is the maximum Row. It must be same of MinR if you want a single
status line.
FA are flexble Attributes for topic writing.
Line(s) are cleared with attribute in FA[0].

Init fails if there are not memory available to store screen contents or
to allocate space for first topic in status line.

example
uses StatLine;
var
SL : StatusLine;
const
FA : FlexAttrs = ($17,$1f,$1e,$70);

begin
if not SL.Init(ScreenHeight,ScreenHeight,FA) then exit;
...
...
end.

---------------------------------------------------------------------------
StatusLine.AddTopic

declaration
function AddTopic (Name: string; K:word):boolean;

purpose
Add a Topic with text to display and key to return

description
Name is text to display into status line.
K is the key to return when clicking in topic whit mouse.

AddTopic returns true if memory available to store request topic
(15 bytes + length(Name)), false elsewhere.

example

if not AddTopic('Esc to Quit ',Word(^[)) then exit;

---------------------------------------------------------------------------
StatLine.IncRow

declaration
function IncRow : boolean;

purpose
increment current Row when constructing topics.

description
If called, next topic will be added to next row in status line
at first column. IncRow returns false if no more rows are available.

example
if AddTopic('Esc to Quit ',Word(^[)) and
IncRow and
AddTopic('Enter to confirm ',Word(^M)) then
Draw;

---------------------------------------------------------------------------
StatusLine.DrawTopic

declaration
procedure DrawTopic(T : StatusTopicPtr); virtual;

purpose
for internal use only. Called by StatusLine.Draw.
draw a topic in status line

description
T is a pointer to StatusTopic (see StatLine.pas) that contains
informations to display the topic


---------------------------------------------------------------------------
StatusLine.HideTopic

declaration
procedure HideTopic(T : StatusTopicPtr); virtual;

purpose
for internal use only. Called by StatusLine.Hide;
Hide a topic in status line

description
T is a pointer to StatusTopic (see StatLine.pas) that contains
informations to display the topic


---------------------------------------------------------------------------
StatusLine.Draw

declaration
procedure Draw; virtual;

purpose
Draws entire Status line

description
Calls DrawTopic for each topic entered with AddTopic.


---------------------------------------------------------------------------
StatusLine.GetKey

declaration
Function GetKey( Row, Col : byte; Defkey : word) : word; virtual;

purpose
Returns a key if Row, Col are into a topic space. Else, DefKey is
returned.

description
Row,Col are position of cursor (MouseCursor)
DefKey is value to return if Row,Col are not recognized by any topic
in status line.

example
uses OpMouse, OpCrt, StatLine;
var
SL : StatusLine;
W : word;

const
FA : FlexAttrs = ($17,$1f,$1e,$70);

function SampleReadKey : Word;
var
Count : Word;
LastX, LastY : byte;
begin
While not KeyOrButtonPressed do;
if MouseButtonPressed(LeftButton,Count,LastX,LastY) then
SampleReadKey := SL.GetKey(LastY,LastX,ReadkeyOrButton)
else
SampleReadKey := ReadKeyOrButton;
end; {SampleReadKey}

begin
if not SL.Init(1,1,FA) then exit;
EnableEventHandling;
ShowMMouse;
with SL do
if AddTopic(^A'F2'^A'-File ',AltF2) and
AddTopic(^A'F3'^A'-Browse ',AltF3) then begin
Draw;
w := SampleReadkey;
HideMouse;
Done;
end;
end.

---------------------------------------------------------------------------
StatusLine.Hide

declaration
procedure Hide; virtual;

purpose
Hide all topics in status line

description
Calls HideTopic for each topic entered with AddTopic.

---------------------------------------------------------------------------
StatusLine.Done

declaration
destructor Done; virtual;

purpose
Deallocate memory occuped by topics and screen memory.
Restore contents of screen before StatusLine.Init

example
see SL_TEST*.PAS
---------------------------------------------------------------------------



 December 15, 2017  Add comments

Leave a Reply