home *** CD-ROM | disk | FTP | other *** search
- { TBigText 3.1 (c) 1995 by Gerry Skolnik (skolnik@kapsch.co.at)
-
- A big thanks to the following contributors:
-
- (c) 1995 by Danny Thorpe
- original scrolling and keyboard handling;
- as he gave no email address, he doesn't
- know about it, I took his stuff from his
- TConsole component :-)
-
- (c) 1995 by David Sampson (dsampson@dca.com) -
- Color, Scroll Bar and Text Attribute enhancements
-
- (c) 1995 by Eric Heverly (erichev@ix.netcom.com)
- Search capability, Positioning, cursor fixes
-
- history:
- TBigText 1.x - first release
- TBigText 2.x - never made it, chaos is not a theory
- TBigText 3.0 - enhancements by David Sampson, Eric Heverly
- TBigText 3.1 - bug fix (horizontal scrolling) by Gerry Skolnik
-
- This component will display up to 32767 lines of text. Each line has its
- own dedicated foreground, background color, text attributes and can be 255
- chars long. If memory permits this is a maximum of about 8MB of data.
- At this time no editing functions are available.
-
- TBigList is still there because at the time I wrote this I didn't know about
- HugeList. Talk about reinventing the wheel.
-
- TBigText is limited to 32767 lines, because the Windows API functions only
- accept integer values. Expect some problems a little earlier, though, at
- about 32740.
-
- TBigText is FreeWare. You may use it freely at your own risk in any
- kind of environment. This component is not to be sold at any charge, and
- must be distributed along with the source code.
-
- If you make modifications or enhancements to this component, please
- contact me via email so that I can include your stuff in the next
- release. As Delphi32 won't produce Win3.x code, and we still will
- have to support Win 3.x, this component may survive a little longer
- longer than I'd expected...
-
- I had two requests I somehow can't find a proper way to fullfill:
- a dedicated font for each line (while that'll be easy, I find the
- scrolling a bit messy then), and word wrapping. Any ideas welcome.
-
- Okay, here's the description of the component:
-
- property MaxLines
- if set to 0, as much lines as memory permits are included. The
- absolute maximum, however, is 32767. If set to something else,
- TBigText will limit itself to that many lines.
-
- property PurgeLines
- determines how to handle the situation when no more lines can be
- added (line count reached Maxlines value or we ran out of memory).
- if set to 0, an exception is raised. If set to something different
- (default 200) the number of lines specified by PurgeLines are
- deleted, the TBigList objects are packed, and most likely more
- lines can be added (though the first ones will be lost).
- This option is useful for logging windows.
-
- property Count
- run-time read-only. If the Lines and TextAttrib counts are equal, this
- property holds the number of lines in TBigText. If the two counts are
- unequal, there's something wrong and the property holds a value of -1.
-
- procedure AddLine(LineString: string; FCol, BCol: TColor; UpdateDisplay: boolean);
- The essential routine to insert lines into TBigText.
- LineString : the text to be inserted
- FCol : forground color
- BCol : background color
- UpdateDisplay: if true, TBigText will scroll to the last line
- (where the new line will be added), and update
- its display. This is not recommended if lots of
- lines are to be included in a loop.
-
- procedure LoadFromFile(FileName: TFileName);
- Loads a file into TBigText. Every line will have the default colors
- clWindowText, clWindow.
-
- procedure Print
- prints all lines on the specified printer. Haven't checked this out, though.
-
- procedure ChangeColor(Index: longint; OldFCol, OldBCol, NewFCol, NewBCol: TColor);
- changes the colors of the line at Index, but only if the current colors
- match OldFCol and OldBCol (FCol = foreground color, BCol = background color).
-
- procedure SetColors(Index: longint; NewFCol, NewBCol: TColor);
- changes the colors of the line at Index
-
- the following procedures do pretty much the same as the according TList methods:
-
- procedure Clear;
- procedure Delete(Index: longint);
- procedure Remove(Index: longint);
- procedure Pack;
-
- ============================================================================
- New Stuff added 8/31/95 by David Sampson
-
- Properties:
- ------------------------
-
- property Colors : changed so that it is the window background color
-
- property ForeColor:
- property BackColor: These are the default forground and background colors
- that will be used to display the text in the window.
-
- property FillBack: Fills the background of the whole line with the Backgnd color
-
- property ScrollBars: Let's you select scrollbars
-
- Methods:
- ------------------------
-
- procedure AddString(LineString: string; UpdateDisplay: boolean);
-
- --This adds a string using the default fore and back colors and left
- alignment.
-
- procedure AddStringA(LineString: string; Fore, Back : TColor;
- Align : TTextAlign; Style : TFontStyles; UpdateDisplay: boolean);
-
- --This lets you add a string and specify the colors, alignment, and text style
-
- procedure AlignText(Index : LongInt; Align : TTextAlign; UpdateDisplay: boolean);
-
- --This lets you set the text alignment on an item.
- Updatedisplay set to true refreshes the display
-
- procedure SetColors(Index: longint; NewFCol, NewBCol: TColor);
-
- --Let's you specify a fore and back color for a specific index
-
- procedure SetStyle (Index : LongInt; Style :TFontStyles; UpdateDisplay: boolean);
-
- --Let's you set the text style
- Updatedisplay set to true refreshes the display
-
- Here's some example calls:
-
- BigText1.AddLine('Hello', clWhite, clNavy, True);
- BigText1.AddString('There', True);
- BigText1.AddStringA('Yogi', clYellow, clRed, taRight, [], True);
- BigText1.AddStringA('Bear', clWhite, clGreen, taCenter, [], True);
- BigText1.AddString('This was left aligned', [], False);
- BigText1.AlignText (BigText1.Count -1, taCenter, true);
- BigText1.SetStyle(BigText1.Count -1, [fsBold, fsItalic, fsUnderline, fsStrikeout], true);
-
- ============================================================================
- New Stuff added by Eric Heverly
-
- Function Search - Added EJH 07/04/95
- Search('this text', True, True);
- Parameters:
- SrcWord : String - What to Look for in the array
- SrchDown : Bool - True - Search down; False - Search Up
- MCase : Bool - True - Match Case Exact; False - Disregard Case
-
- Returns: True - Found ; False - Not Found
-
- Note: This is a little screwy because it does not redisplay the
- last page if text is found there when already on the last page.
- Also, during displays of found data, on the last call, if the
- user closes the finddialog, I could not see an automatic way
- for this application to know that it was not visible, so the
- final blue line stays on the screen untill the window scrolls
- beyond it, from then on it is not there. This is sometimes
- useful, othertimes it is just ugly.
-
- Note: To find exact matches if you have the option available to the
- user, put a space on both sides of SrcWord, otherwise partial
- matches are used.
-
- Modifications - Eric Heverly - July 1995 (erichev@ix.netcom.com)
-
- Scroll- Added keys F1-F4 to the Scrool Keys table.
- Print - Added canvas font for the display canvas to the printer
- so the expected printer font was the same. Also added some
- Cursor := crHourGlass to show that the system was busy during
- print cycles.
- Search- Added function.
- GoPosi- GoPosition function added.
- LoadFr- LoadFromFile added some Cursor := crHourGlass to show the
- user that the system is busy. Also I changed the call to the
- addline function to use the dumchar, this keeps the font to
- the defined font in the object editor (ie. I used Courier and
- this way it kept Courier as the display font, with the OEM
- characters, it always used the System font).
-
- }
-