Subject Re: [IBO] TIBOBCDField bug
Author Daniel Rail
Hi Jason,

Here are the modifications, notice that I commented out in the class
declarations what isn't needed. All the code is related to the
IBDataset.pas file.

TIBOBCDField = class( TBCDField )
private
//FCurrency: Boolean;
//FCheckRange: Boolean;
//FMinValue: Currency;
//FMaxValue: Currency;
//FPrecision: Integer;
//procedure SetCurrency(Value: Boolean);
//procedure SetMaxValue(Value: Currency);
//procedure SetMinValue(Value: Currency);
//procedure UpdateCheckRange;
protected
class procedure CheckTypeSize(Value: Integer); override;
function GetAsCurrency: Currency; override;
//function GetAsFloat: Double; override;
//function GetAsInteger: Longint; override;
function GetAsString: string; override;
function GetAsVariant: Variant; override;
{$IFDEF IBO_VCL50_OR_GREATER}
function GetDataSize: Integer; override;
{$ELSE}
function GetDataSize: Word; override;
{$ENDIF}
//function GetDefaultWidth: Integer; override;
//procedure GetText(var Text: string; DisplayText: Boolean); override;
//function GetValue(var Value: Currency): Boolean;
//procedure SetAsCurrency(Value: Currency); override;
//procedure SetAsFloat(Value: Double); override;
//procedure SetAsInteger(Value: Longint); override;
//procedure SetAsString(const Value: string); override;
//procedure SetVarValue(const Value: Variant); override;
public
constructor Create(AOwner: TComponent); override;
//property Value: Currency read GetAsCurrency write SetAsCurrency;
published
//property Currency: Boolean read FCurrency write SetCurrency default False;
//property MaxValue: Currency read FMaxValue write SetMaxValue;
//property MinValue: Currency read FMinValue write SetMinValue;
property Size default 8;
end;

Here are the methods, you'll notice that most of the remaining methods have
some or no modifications:

constructor TIBOBCDField.Create(AOwner: TComponent);
begin
inherited Create( AOwner );
SetDataType( ftBCD );
{inherited }Size := 8;
//ValidChars := [DecimalSeparator, '+', '-', '0'..'9'];
end;

class procedure TIBOBCDField.CheckTypeSize(Value: Integer);
begin
// if Value > 32 then DatabaseError(SInvalidFieldSize);
end;

function TIBOBCDField.GetAsCurrency: Currency;
begin
if not GetValue(Result) then Result := 0;
end;

function TIBOBCDField.GetAsString: string;
var
C: System.Currency;
begin
if GetValue(C) then Result := CurrToStr(C) else Result := '';
end;

function TIBOBCDField.GetAsVariant: Variant;
var
C: System.Currency;
begin
if GetValue(C) then Result := C else Result := Null;
end;

{$IFDEF IBO_VCL50_OR_GREATER}
function TIBOBCDField.GetDataSize: integer;
{$ELSE}
function TIBOBCDField.GetDataSize: Word;
{$ENDIF}
begin
Result := 8;
end;

Glad to help and have a wonderful weekend.

Daniel Rail

At 30/03/2001 14:12, you wrote:
>Daniel,
>
>Are you saying that you have made some modifications to the IBO sources that
>fixes a problem for you?
>
>Please send me the modified IBO sources that are working for you.
>
>Thanks,
>Jason Wharton
>CPS - Mesa AZ
><http://www.ibobjects.com>http://www.ibobjects.com
>
>
>
>Yahoo! Groups Sponsor
><http://rd.yahoo.com/M=162801.1342103.2934627.1280005/D=egroupmail/S=1700007183:N/A=599089/*http://www.knowledgestorm.com/jump_white.html?c=Yahoo&n=eLert_ComputersInternet_Software_WhiteGridOptions&t=ad>
>Click Here to Find Software Faster
>
>Your use of Yahoo! Groups is subject to the
><http://docs.yahoo.com/info/terms/>Yahoo! Terms of Service.