fix error with empty sring in TRxDateEdit

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@358 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2008-02-22 09:41:18 +00:00
parent 9c08448885
commit 68a637e733
7 changed files with 66 additions and 38 deletions

View File

@ -33,6 +33,7 @@
+ TDBDateEdit inherited from TRxDateEdit, for old style use DBDateEdit_OLD compiller directive + TDBDateEdit inherited from TRxDateEdit, for old style use DBDateEdit_OLD compiller directive
(see rx.inc). (see rx.inc).
+ In RxDBGrid property FixedHotColor now published + In RxDBGrid property FixedHotColor now published
- fix error with empty sring in TRxDateEdit.
29.08.2007 - ������ 1.1.5.98 (svn revision 39) 29.08.2007 - ������ 1.1.5.98 (svn revision 39)
+ In RxDBgrid - after close dataset list of SelectedRows is cleared + In RxDBgrid - after close dataset list of SelectedRows is cleared
+ fix resaizing find form for RxDbGrd + fix resaizing find form for RxDbGrd

View File

@ -39,6 +39,7 @@
�������� ��������� DBDateEdit_OLD. ��� ����������������� �������� ���������� ����������� ��� ����� �������� ��������� DBDateEdit_OLD. ��� ����������������� �������� ���������� ����������� ��� �����
� ���������. � ���������.
+ � RxDBGrid ������������ ����������� ���� + � RxDBGrid ������������ ����������� ����
- ���������� ������ � ��������� ������ ���� � ��������� ���.
29.08.2007 - ������ 1.1.5.98 (svn revision 39) 29.08.2007 - ������ 1.1.5.98 (svn revision 39)
+ � RxDBGrid ����� �������� ������ ������ ������ ���������� ����� (SelectedRows) + � RxDBGrid ����� �������� ������ ������ ������ ���������� ����� (SelectedRows)
��������� ���������

View File

@ -3,6 +3,7 @@
{$H+} {$H+}
{$DEFINE RX_D3} {$DEFINE RX_D3}
{$DEFINE RX_D4}
{$DEFINE HASVARIANT} {$DEFINE HASVARIANT}
{.$DEFINE ENABLE_Child_Defs} {.$DEFINE ENABLE_Child_Defs}
{$DEFINE NEW_STYLE_TITLE_ALIGNMENT_RXDBGRID} {$DEFINE NEW_STYLE_TITLE_ALIGNMENT_RXDBGRID}

View File

@ -12,7 +12,6 @@ unit rxclock;
interface interface
{$I rx.inc} {$I rx.inc}
uses LCLType, LMessages, SysUtils, Classes, Graphics, Controls, Forms, StdCtrls, uses LCLType, LMessages, SysUtils, Classes, Graphics, Controls, Forms, StdCtrls,
ExtCtrls, Menus, messages; ExtCtrls, Menus, messages;
@ -666,12 +665,16 @@ begin
try try
Canvas.Brush.Color := Canvas.Pen.Color; Canvas.Brush.Color := Canvas.Pen.Color;
MinDots := ((DotWidth > MinDotWidth) and (DotHeight > MinDotHeight)); MinDots := ((DotWidth > MinDotWidth) and (DotHeight > MinDotHeight));
for Pos := 0 to HandPositions - 1 do begin for Pos := 0 to HandPositions - 1 do
begin
R.Top := (CircleTab^[Pos].Y * FClockRadius) div CirTabScale + FClockCenter.Y; R.Top := (CircleTab^[Pos].Y * FClockRadius) div CirTabScale + FClockCenter.Y;
R.Left := (CircleTab^[Pos].X * FClockRadius) div CirTabScale + FClockCenter.X; R.Left := (CircleTab^[Pos].X * FClockRadius) div CirTabScale + FClockCenter.X;
if (Pos mod 5) <> 0 then begin if (Pos mod 5) <> 0 then
if MinDots then begin begin
if Ctl3D then begin if MinDots then
begin
if Ctl3D then
begin
Canvas.Brush.Color := clBtnShadow; Canvas.Brush.Color := clBtnShadow;
OffsetRect(R, -1, -1); OffsetRect(R, -1, -1);
R.Right := R.Left + 2; R.Right := R.Left + 2;
@ -790,24 +793,31 @@ begin
Canvas.Pen.Color := Font.Color; Canvas.Pen.Color := Font.Color;
Canvas.Brush.Color := Color; Canvas.Brush.Color := Color;
SetBkMode(Canvas.Handle, TRANSPARENT); SetBkMode(Canvas.Handle, TRANSPARENT);
if PaintMode = pmPaintAll then begin if PaintMode = pmPaintAll then
with Canvas do begin begin
with Canvas do
begin
FillRect(FClockRect); FillRect(FClockRect);
Pen.Color := Self.Font.Color; Pen.Color := Self.Font.Color;
DrawAnalogFace; DrawAnalogFace;
DrawFatHand(HourHandPos(FDisplayTime), True); DrawFatHand(HourHandPos(FDisplayTime), True);
DrawFatHand(FDisplayTime.Minute, False); DrawFatHand(FDisplayTime.Minute, False);
Pen.Color := Brush.Color; Pen.Color := Brush.Color;
if ShowSeconds then DrawSecondHand(FDisplayTime.Second); if ShowSeconds then
DrawSecondHand(FDisplayTime.Second);
end; end;
end end
else begin else
with Canvas do begin begin
with Canvas do
begin
Pen.Color := Brush.Color; Pen.Color := Brush.Color;
GetTime(NewTime); GetTime(NewTime);
if NewTime.Hour >= 12 then Dec(NewTime.Hour, 12); if NewTime.Hour >= 12 then
Dec(NewTime.Hour, 12);
if (NewTime.Second <> FDisplayTime.Second) then if (NewTime.Second <> FDisplayTime.Second) then
if ShowSeconds then DrawSecondHand(FDisplayTime.Second); if ShowSeconds then
DrawSecondHand(FDisplayTime.Second);
if ((NewTime.Minute <> FDisplayTime.Minute) or if ((NewTime.Minute <> FDisplayTime.Minute) or
(NewTime.Hour <> FDisplayTime.Hour)) then (NewTime.Hour <> FDisplayTime.Hour)) then
begin begin
@ -818,8 +828,10 @@ begin
DrawFatHand(HourHandPos(NewTime), True); DrawFatHand(HourHandPos(NewTime), True);
end; end;
Pen.Color := Brush.Color; Pen.Color := Brush.Color;
if (NewTime.Second <> FDisplayTime.Second) then begin if (NewTime.Second <> FDisplayTime.Second) then
if ShowSeconds then DrawSecondHand(NewTime.Second); begin
if ShowSeconds then
DrawSecondHand(NewTime.Second);
FDisplayTime := NewTime; FDisplayTime := NewTime;
end; end;
end; end;

View File

@ -2561,7 +2561,7 @@ begin
if (Flags and DT_CALCRECT <> 0) and ((AText = '') or FShowAccelChar and if (Flags and DT_CALCRECT <> 0) and ((AText = '') or FShowAccelChar and
(AText[1] = '&') and (AText[2] = #0)) then AText := AText + ' '; (AText[1] = '&') and (AText[2] = #0)) then AText := AText + ' ';
if not FShowAccelChar then Flags := Flags or DT_NOPREFIX; if not FShowAccelChar then Flags := Flags or DT_NOPREFIX;
{$IFDEF RX_D4} {$IFDEF USED_BiDi}
Flags := DrawTextBiDiModeFlags(Flags); Flags := DrawTextBiDiModeFlags(Flags);
{$ENDIF} {$ENDIF}
Canvas.Font := Font; Canvas.Font := Font;
@ -2647,7 +2647,7 @@ begin
InflateRect(Rect, 1, 0); InflateRect(Rect, 1, 0);
X := Left; X := Left;
AAlignment := FAlignment; AAlignment := FAlignment;
{$IFDEF RX_D4} {$IFDEF USED_BiDi}
if UseRightToLeftAlignment then ChangeBiDiModeAlignment(AAlignment); if UseRightToLeftAlignment then ChangeBiDiModeAlignment(AAlignment);
{$ENDIF} {$ENDIF}
if AAlignment = taRightJustify then Inc(X, Width - Rect.Right); if AAlignment = taRightJustify then Inc(X, Width - Rect.Right);
@ -3145,7 +3145,7 @@ begin
R.Bottom := R.Top + FTxtDivider; R.Bottom := R.Top + FTxtDivider;
Flags := {DT_EXPANDTABS or }Alignments[FAlignment] or DT_SINGLELINE or Flags := {DT_EXPANDTABS or }Alignments[FAlignment] or DT_SINGLELINE or
DT_NOCLIP or DT_NOPREFIX; DT_NOCLIP or DT_NOPREFIX;
{$IFDEF RX_D4} {$IFDEF USED_BiDi}
Flags := DrawTextBiDiModeFlags(Flags); Flags := DrawTextBiDiModeFlags(Flags);
{$ENDIF} {$ENDIF}
for I := FFirstLine to FLines.Count do begin for I := FFirstLine to FLines.Count do begin

View File

@ -538,17 +538,17 @@ function TRxMemoryData.FindFieldData(Buffer: Pointer; Field: TField): Pointer;
var var
Index: Integer; Index: Integer;
begin begin
{$IFDEF RX_D4} {.$IFDEF RX_D4}
Index := FieldDefList.IndexOf(Field.FullName); // Index := FieldDefList.IndexOf(Field.FullName);
{$ELSE} {.$ELSE}
Index := FieldDefs.IndexOf(Field.FieldName); Index := FieldDefs.IndexOf(Field.FieldName);
{$ENDIF} {.$ENDIF}
if (Index >= 0) and (Buffer <> nil) and if (Index >= 0) and (Buffer <> nil) and
{$IFDEF RX_D4} {.$IFDEF RX_D4}
(FieldDefList[Index].DataType in ftSupported - ftBlobTypes) then // (FieldDefList[Index].DataType in ftSupported - ftBlobTypes) then
{$ELSE} {.$ELSE}
(FieldDefs[Index].DataType in ftSupported - ftBlobTypes) then (FieldDefs[Index].DataType in ftSupported - ftBlobTypes) then
{$ENDIF} {.$ENDIF}
Result := Pointer(Integer(PChar(Buffer)) + FOffsets^[Index]) Result := Pointer(Integer(PChar(Buffer)) + FOffsets^[Index])
else Result := nil; else Result := nil;
end; end;
@ -712,6 +712,7 @@ begin
Result := RecBuf <> nil; Result := RecBuf <> nil;
end; end;
{$IFDEF FIX_BUG_FieldNo}
function GetFieldNo(DS:TDataSet; Field:TField):integer; function GetFieldNo(DS:TDataSet; Field:TField):integer;
var var
i:integer; i:integer;
@ -724,6 +725,7 @@ begin
end; end;
Result:=0; Result:=0;
end; end;
{$ENDIF}
function TRxMemoryData.GetFieldData(Field: TField; Buffer: Pointer): Boolean; function TRxMemoryData.GetFieldData(Field: TField; Buffer: Pointer): Boolean;
var var
@ -732,8 +734,11 @@ var
begin begin
Result := False; Result := False;
if not GetActiveRecBuf(RecBuf) then Exit; if not GetActiveRecBuf(RecBuf) then Exit;
// if Field.FieldNo > 0 then {$IFDEF FIX_BUG_FieldNo}
if GetFieldNo(Self, Field) > 0 then if GetFieldNo(Self, Field) > 0 then
{$ELSE}
if Field.FieldNo > 0 then
{$ENDIF}
begin begin
Data := FindFieldData(RecBuf, Field); Data := FindFieldData(RecBuf, Field);
if Data <> nil then begin if Data <> nil then begin
@ -767,13 +772,17 @@ procedure TRxMemoryData.SetFieldData(Field: TField; Buffer: Pointer);
var var
RecBuf, Data: PChar; RecBuf, Data: PChar;
VarData: Variant; VarData: Variant;
PBl:PBoolean;
begin begin
if not (State in dsWriteModes) then Error(SNotEditing); if not (State in dsWriteModes) then Error(SNotEditing);
GetActiveRecBuf(RecBuf); GetActiveRecBuf(RecBuf);
with Field do with Field do
begin begin
// if Field.FieldNo > 0 then {$IFDEF FIX_BUG_FieldNo}
if GetFieldNo(Self, Field) > 0 then if GetFieldNo(Self, Field) > 0 then
{$ELSE}
if Field.FieldNo > 0 then
{$ENDIF}
begin begin
if State in [dsCalcFields, dsFilter] then Error(SNotEditing); if State in [dsCalcFields, dsFilter] then Error(SNotEditing);
if ReadOnly and not (State in [dsSetKey, dsFilter]) then if ReadOnly and not (State in [dsSetKey, dsFilter]) then
@ -800,9 +809,12 @@ begin
end end
else else
begin begin
Boolean(Data[0]) := LongBool(Buffer); PBl:=Pointer(Data);
// Boolean(Data^{[0]}) := Assigned(Buffer);//LongBool(Buffer);
// Pbl^:=Assigned(Buffer);
PBoolean(Pointer(Data))^:= Assigned(Buffer);
Inc(Data); Inc(Data);
if LongBool(Buffer) then if Assigned(Buffer) then
Move(Buffer^, Data^, CalcFieldLen(DataType, Size)) Move(Buffer^, Data^, CalcFieldLen(DataType, Size))
else else
FillChar(Data^, CalcFieldLen(DataType, Size), 0); FillChar(Data^, CalcFieldLen(DataType, Size), 0);

View File

@ -233,7 +233,7 @@ var
DC: HDC; DC: HDC;
PS: TPaintStruct; PS: TPaintStruct;
S: string; S: string;
{$IFDEF RX_D4} {$IFDEF USED_BiDi}
ExStyle: DWORD; ExStyle: DWORD;
const const
AlignStyle: array[Boolean, TAlignment] of DWORD = AlignStyle: array[Boolean, TAlignment] of DWORD =
@ -244,13 +244,13 @@ begin
Result := True; Result := True;
with Editor do with Editor do
begin begin
{$IFDEF RX_D4} {$IFDEF USED_BiDi}
// if UseRightToLeftAlignment then ChangeBiDiModeAlignment(AAlignment); if UseRightToLeftAlignment then ChangeBiDiModeAlignment(AAlignment);
{$ENDIF} {$ENDIF}
if StandardPaint and not(csPaintCopy in ControlState) then if StandardPaint and not(csPaintCopy in ControlState) then
begin begin
{$IFDEF RX_D4} {$IFDEF USED_BiDi}
(* if SysLocale.MiddleEast and HandleAllocated and (IsRightToLeft) then if SysLocale.MiddleEast and HandleAllocated and (IsRightToLeft) then
begin { This keeps the right aligned text, right aligned } begin { This keeps the right aligned text, right aligned }
ExStyle := DWORD(GetWindowLong(Handle, GWL_EXSTYLE)) and (not WS_EX_RIGHT) and ExStyle := DWORD(GetWindowLong(Handle, GWL_EXSTYLE)) and (not WS_EX_RIGHT) and
(not WS_EX_RTLREADING) and (not WS_EX_LEFTSCROLLBAR); (not WS_EX_RTLREADING) and (not WS_EX_LEFTSCROLLBAR);
@ -262,8 +262,8 @@ begin
AlignStyle[UseRightToLeftAlignment, AAlignment]; AlignStyle[UseRightToLeftAlignment, AAlignment];
if DWORD(GetWindowLong(Handle, GWL_EXSTYLE)) <> ExStyle then if DWORD(GetWindowLong(Handle, GWL_EXSTYLE)) <> ExStyle then
SetWindowLong(Handle, GWL_EXSTYLE, ExStyle); SetWindowLong(Handle, GWL_EXSTYLE, ExStyle);
end; *) end;
{$ENDIF RX_D4} {$ENDIF USED_BiDi}
Result := False; Result := False;
{ return false if we need to use standard paint handler } { return false if we need to use standard paint handler }
Exit; Exit;
@ -312,7 +312,7 @@ begin
ALeft := (ClientWidth {- ButtonWidth} - AWidth) div 2; ALeft := (ClientWidth {- ButtonWidth} - AWidth) div 2;
end; end;
{ end;} { end;}
{$IFDEF RX_D4} {$IFDEF USED_BiDi}
if SysLocale.MiddleEast then UpdateTextFlags; if SysLocale.MiddleEast then UpdateTextFlags;
{$ENDIF} {$ENDIF}
Brush.Style := bsClear; Brush.Style := bsClear;
@ -354,6 +354,7 @@ function TCustomRxDateEdit.GetDate: TDateTime;
begin begin
if DefaultToday then Result := SysUtils.Date if DefaultToday then Result := SysUtils.Date
else Result := NullDate; else Result := NullDate;
if Text<>'' then
Result := StrToDateFmtDef(FDateFormat, Text, Result); Result := StrToDateFmtDef(FDateFormat, Text, Result);
end; end;