[delphizip] Re: Problems installing version 1.70.

  • From: "R. Peters" <russellpeters@xxxxxxxxxxx>
  • To: delphizip@xxxxxxxxxxxxx
  • Date: Thu, 08 May 2003 08:43:50 +1000

You are right about the tryXXXX functions but they are only needed for
earlier versions of Delphi so never showed up any errors under Delphi 6 (no
real excuse for missing 'var').
I had changed the original SortGrid code to use the new tryXXXX functions to
get away from the problems with exceptions but supplied those functions for
earlier versions.
They are functionally equivalent to the original code so should have been no
worse (if I had declared them correctly).
- Russell Peters
----- Original Message ----- 
From: "Achim Kalwa" <achim.kalwa@xxxxxxxxxxx>
To: <delphizip@xxxxxxxxxxxxx>
Sent: Wednesday, May 07, 2003 6:57 PM
Subject: [delphizip] Re: Problems installing version 1.70.


>
> Hello,
>
> > Marcos Soares Sobrinho wrote:
> >
> >>When I try to compile (install) the package (version 1.70), apears
> >>this message: "undeclared identifier:'TryStrToDateTime'". What can I
> >>do?
>
> > Can you indicate what package TZipMaster or TZipBuilder?
> >
> > When you get this error what line of code is the compiler pointing to,
> > please indicate also the function name?
> >
> > BTW the latest version for both packages is 1.72
> > It is best to use the latest version
>
> I've just downloaded ZipMaster 1.72 and got problems compiling. Since
> there is no package (dpk) inside ZIP archive, I've created a new package
> and included ZipMstr.pas and SortGrid.pas.
>
> TryStrToDateTime is declared in SortGrid.pas if Delphi5 or older is
> used. Newer Delphi version have those functions predefined. And here is
> the problem: all TryStrToXXXX-functions in SortGrid.pas
>
> - do not work at all, because they are declared wrong,
> - uses exceptions for normal processing.
>
> For example:
> TryStrToInt is defined as
>
>   function TryStrToInt(s: string; v: integer): boolean;
>
> As "v" is an input parameter only, the converted value is never
> returned. The compiler warns about this! So the function should be
> defined as:
>
>   function TryStrToInt(const s: string; var v: integer): boolean;
>
> or better
>
>   function TryStrToInt(const s: string; out v: integer): boolean;
>
> To remove the need for exceptions inside the functions I recommend to
> change the code as following (at least for the Int and Float functions):
>
> function TryStrToInt(const s: string; out v: Integer): Boolean;
> var
>   ErrorPos : Integer;
> begin
>   Val(s, v, ErrorPos);
>   Result := (ErrorPos = 0);
> end;
>
> function TryStrToFloat(const s: string; out v: Extended): boolean;
> begin
>   Result := TextToFloat(PChar(S), Value, fvExtended);
> end;
>
> The functions TryStrToTime and TryStrToDateTime can not be changed
> easily, because it would require to make SysUtils.ScanTime public or to
> copy large parts from SysUtils.pas
>
> BTW:
> The sourcecode is ugly formatted. Why don't follow borland or jedi
> coding style guides and use a sourcecode formater like DelFoxExp or
> JediCodeFormat?
>
> TSortGrid seems to be a common name for a sorting grid. I got errors
> when installing because some other package contains a "TSortGrid". Would
> it be possible to rename this component to TDZSortGrid? (even if it is
> not directly related to DelphiZip).
>
>
> Regards
> Achim
>
>
>
>
> -----------
> To unsubscribe from this list, send an empty e-mail
> message to:
>   delphizip-request@xxxxxxxxxxxxx
> and put the word unsubscribe in the subject.


-----------
To unsubscribe from this list, send an empty e-mail 
message to:
  delphizip-request@xxxxxxxxxxxxx 
and put the word unsubscribe in the subject.

Other related posts: