MSTRLIST

Version 2.2b,  26.1.1997,  PostCardWare, Albrecht Mengel, mengel@stat-econ.uni-kiel.de

If you have problems/ideas with mStrList, please feel free to email me!

**** Bug in RestoreOrderInGroups fixed

**** Bugfix: When ampm is in DateTimeFormat, an error occured, if there was no time entry in
     data found.

**** CHANGED:  TMSortType -> TLSortType, soString -> sString, ... , soDate -> sDate  ******
     This was important, otherwise mStrGrid Users should manually include mStrList to their
     USES list, when using setting mStrGrid1.KeyType values. Sorry! (The compiler will warn you)
     If needed you can typecast list.KeyType:=TLSortType(grid.KeyType) or
     grid.KeyType:=TMSortType(list.KeyType). I'll hold TMSortType and TLSortType compatible.

New Properties:

DateTimeFormat:string;
     (Reasons for:
      1. I former used the internal DateTime format, but there are simply too much crashes,
         when the date encountered is not valid
      2. The setting of the global ShortDateFormat has no influence on the interpretation,
         so mStrList interprets selv and is sensible to the own DateTimeFormat.)
     When sorting dates, they are interpreted in the kind as DateTimeFormat is set to.
     (see above: KeyType / Date sorting)
ShortYearExpand:boolean;
     if true (default), expands 2-digit-years to 4-digit-years.
ShortYearBorder:(0..99);
     lower values of 2-digit-years are converted to 2000's years and
     greater values of 2-digit-years are converted to 2000's years.
     Default is 10, that means: 0..9 -> 200x and 10..99 -> 19xx

Tips: - Just add MStrList to the USES-List. Check, that your Project Path sees MStrList.pas
        Then you can easy use this enhanced StringList for your own use.
      - You can copy MStrList as to many StringLists (for TListBox or TMemo). Usage:
	var L:TmStrList;
        begin L:=TmStrList.create; {Get Memory and create the List}
	      try {Set several properties of L, f.x. L.KeyType:=soNumeric}
	          {Call some methods of L, f.x. L.add(something); ... ; L.sorted:=true};
	          Memo1.lines:=L;  {Here the contents of the memo is replaced}
                  ListBox1.items:=L; {The ListBox can get its items too from L}
              finally
                  L.free {Detroy the list and free the memory}
              end {If you trust in you and me you could omit the try-finally-end construction,
        end       {but better save then sorry}

This is a sister of TStringList with some new sorting properties:

property KeyType:(soString,soStringCaseSensitive,soNumeric,soDate)
   This is the kind, how the keys (and cells) are compared.
   If you work with soNumeric, all non numbers get the same value 0.
      As these zero values would flip in random order a (case insensitive) string sort
      is performed after. So, first come the negatives, then the strings, and thereafter
      the positives.
   Date sorting works now with an own Date-Time comparison. The format of the date/time
      is controlled by the property DateTimeFormat, which is by default ShortDateFormat+' '+LongTimeFormat.
      ( ShortDateFormat and LongTimeFormat are global in Delphi and are set anywhere in
      the options or in the system). The format is similar to the format of ShortDateFormat
      and LongTimeFormat: Use D M Y for day, month, year, and H M (or N) S T for hours, minutes,
      seconds, and 1/100 seconds. Some examples:
      'mm/dd/yy hh:mm' or 'dd.mm.yyyy hh:mm:ss'
      mStrList does not expect the count of digits you have in the format, just the order.
      Watch: Illegal formats raises errors! If you edit with OnChange, uncheck in Tools/Options/...
      the 'stop on Exception' (or so. I don't know the english menu). Sample:
         procedure TForm1.formatChange(Sender:TObject);
           begin try mStrGrid1.DateTimeFormat:=format.text except end
           end;
   property ShortYearExpand:boolean; (default: true)
     if set, 2-digit-years are expanded 4-digit-years, dependend of the seeting of:
   property ShortYearBorder:(0..99);
     lower values of 2-digit-years are converted to 2000's years and
     greater values of 2-digit-years are converted to 2000's years.
     Default is 10, that means: 0..9 -> 200x and 10..99 -> 19xx
property KeyPos:Integer;
property KeyLen:Integer;
   Here you may define, which substring of the cells is used to comparision.
   (Default is KeyPos=1 & KeyLen=MaxInt)
property ScipFirst:Integer;
   Here you can exclude some first entries from sorting.
   (It is used by mStringGrid for excluding fixed rows/cols)
property SortDescending:Boolean;
   false (default) : Ascending sorting order
   true            : Descending sorting order

When you set sorting to true then the sorting is done with the new properties.
The default settings result in the same sorting as TStringList does.

TmStrList is a copy of TStringList found in \source\vcl\CLASSES.pas with some additional
entries.
I had a problem with compiling TStringList.Changed and TStringList.Changing:
They call the property FUpdateCount which I could not reach:

procedure TmStrList.Changed;
begin
  if {!(FUpdateCount = 0) and} Assigned(FOnChange) then FOnChange(Self);
end;

procedure TmStrList.Changing;
  ... the same ...

Why, (the hell!) can Delphi library compile that and not me ??????

Is there anyone to fix that problem???

Software development:

Programming consumes time, and programmed components save time.
If you like my components feel free to send me some acknowledgment.
I accept post cards of your town, money or cheques (2$ up to 20$),
if you use mStrGrid for private.
For commercial use I give this code free for $20 (or more).
This is a motivation for me to continue developing for you.

If you have some ideas to improve mStrList, mStrGrid or any other component
send me a message.

The mStrList is copyright (C) 1996, by Albrecht Mengel. You may give copies to
others by copying the original, unmodified zip file. You may use this component
in your own projects free of charge as long as those projects are public domain,
freeware or shareware project.

The author of mStrList (A. Mengel) makes no warranty of any kind,
expressed or implied, including without limitation any warranties of merchantability
and/or fitness for a particular purpose. In no event will the author be liable to you
for any additional damages, including any lost profits, lost savings, or other
incidental or consequential damages arising from the use of, or inability to use,
this software and its accompanying documentation, even if the author has been advised
of the possibility of such damages.

Albrecht Mengel, University of Kiel, Germany
Institute for Statistics & Economics
Olshausenstrasse 40-60,
D-24098 Kiel
Tel. +49-431-880-2424
Fax. +49-431-880-2673
Email: mengel@stat-econ.uni-kiel.de
http://www.stat-econ.uni-kiel.de/pers/mengel.htm
