fixed lcl package unit file name checklist.pas

git-svn-id: trunk@5675 -
This commit is contained in:
mattias 2004-07-13 10:34:15 +00:00
parent a71f55e21d
commit 2a4f175ec4
8 changed files with 112 additions and 67 deletions

View File

@ -291,14 +291,6 @@ type
FPropCount: Integer;
FPropList: PInstPropList;
function GetPrivateDirectory: ansistring;
protected
procedure SetFloatValue(const NewValue: Extended);
procedure SetMethodValue(const NewValue: TMethod);
procedure SetInt64Value(const NewValue: Int64);
procedure SetOrdValue(const NewValue: Longint);
procedure SetStrValue(const NewValue: AnsiString);
procedure SetVarValue(const NewValue: Variant);
procedure Modified;
public
constructor Create(Hook:TPropertyEditorHook;
APersistentList: TPersistentSelectionList;
@ -342,6 +334,13 @@ type
procedure SetValue(const NewValue: ansistring); virtual;
procedure SetPropEntry(Index: Integer; AnInstance: TPersistent;
APropInfo: PPropInfo);
procedure SetFloatValue(const NewValue: Extended);
procedure SetMethodValue(const NewValue: TMethod);
procedure SetInt64Value(const NewValue: Int64);
procedure SetOrdValue(const NewValue: Longint);
procedure SetStrValue(const NewValue: AnsiString);
procedure SetVarValue(const NewValue: Variant);
procedure Modified;
function ValueAvailable: Boolean;
procedure ListMeasureWidth(const AValue: ansistring; Index:integer;
ACanvas:TCanvas; var AWidth: Integer); dynamic;
@ -2922,7 +2921,8 @@ var
begin
Integer(S) := GetOrdValue;
if CompareText(NewValue, 'True') = 0 then
Include(S, FElement) else
Include(S, FElement)
else
Exclude(S, FElement);
SetOrdValue(Integer(S));
end;

View File

@ -58,7 +58,7 @@ type
be changed }
TNumGlyphs = 1..4;
TButton = class(TButtonControl)
TCustomButton = class(TButtonControl)
private
FCancel: Boolean;
FDefault: Boolean;
@ -81,23 +81,28 @@ type
procedure ExecuteDefaultAction; override;
procedure ExecuteCancelAction; override;
procedure UpdateRolesForForm; override;
published
property Action;
property Anchors;
property Align;
property Constraints;
public
property Default: Boolean read FDefault write SetDefault default false;
property Enabled;
property ModalResult: TModalResult read FModalResult write FModalResult default mrNone;
property Cancel: Boolean read FCancel write SetCancel default false;
property Caption;
property Font;
property TabStop default true;
property TabOrder;
property PopupMenu;
property ShowHint;
property ParentShowHint;
property Visible;
end;
{ TButton }
TButton = class(TCustomButton)
published
property Action;
property Align;
property Anchors;
property Cancel;
property Caption;
property Constraints;
property Default;
property Enabled;
property Font;
property ModalResult;
property OnClick;
property OnEnter;
property OnExit;
@ -108,6 +113,12 @@ type
property OnMouseMove;
property OnMouseUp;
property OnResize;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
end;
@ -333,6 +344,9 @@ end.
{ =============================================================================
$Log$
Revision 1.72 2004/07/13 10:34:15 mattias
fixed lcl package unit file name checklist.pas
Revision 1.71 2004/07/11 13:03:53 mattias
extended RolesForForm to manage multiple roles for on control

View File

@ -28,13 +28,14 @@ unit CheckLst;
interface
uses
Classes, SysUtils, StdCtrls, Graphics, GraphType, Controls, VCLGlobals, LMessages;
Classes, SysUtils, GraphType, Graphics, VCLGlobals, LMessages, Controls,
StdCtrls;
type
{ TCheckListBox }
{ TCustomCheckListBox }
TCheckListBox = class(TCustomListBox)
TCustomCheckListBox = class(TCustomListBox)
private
FItemDataOffset: Integer;
function GetChecked(const AIndex: Integer): Boolean;
@ -47,10 +48,17 @@ type
public
constructor Create(AOwner: TComponent); override;
property Checked[const AIndex: Integer]: Boolean read GetChecked write SetChecked;
end;
{ TCheckListBox }
TCheckListBox = class(TCustomCheckListBox)
published
property Align;
property Anchors;
property BorderStyle;
property Constraints;
property ExtendedSelect;
property Items;
property ItemHeight;
@ -91,35 +99,35 @@ type
PCachedItemData = ^TCachedItemData;
TCachedItemData = Boolean;
{ TCheckListBox }
{ TCustomCheckListBox }
procedure TCheckListBox.AssignCacheToItemData(const AIndex: Integer; const AData: Pointer);
procedure TCustomCheckListBox.AssignCacheToItemData(const AIndex: Integer; const AData: Pointer);
begin
inherited AssignCacheToItemData(AIndex, AData);
if PCachedItemData(AData + FItemDataOffset)^
then SendItemChecked(AIndex, True);
end;
procedure TCheckListBox.AssignItemDataToCache(const AIndex: Integer; const AData: Pointer);
procedure TCustomCheckListBox.AssignItemDataToCache(const AIndex: Integer; const AData: Pointer);
begin
inherited AssignItemDataToCache(AIndex, AData);
PCachedItemData(AData + FItemDataOffset)^ := Checked[AIndex];
end;
constructor TCheckListBox.Create(AOwner: TComponent);
constructor TCustomCheckListBox.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FCompStyle := csCheckListBox;
FItemDataOffset := inherited GetCachedDataSize;
end;
function TCheckListBox.GetCachedDataSize: Integer;
function TCustomCheckListBox.GetCachedDataSize: Integer;
begin
FItemDataOffset := inherited GetCachedDataSize;
Result := FItemDataOffset + SizeOf(TCachedItemData);
end;
function TCheckListBox.GetChecked(const AIndex: Integer): Boolean;
function TCustomCheckListBox.GetChecked(const AIndex: Integer): Boolean;
begin
CheckIndex(AIndex);
@ -128,7 +136,7 @@ begin
else Result := PCachedItemData(GetCachedData(AIndex) + FItemDataOffset)^;
end;
procedure TCheckListBox.SendItemChecked(const AIndex: Integer; const AChecked: Boolean);
procedure TCustomCheckListBox.SendItemChecked(const AIndex: Integer; const AChecked: Boolean);
var
Msg : TLMSetChecked;
begin
@ -140,7 +148,7 @@ begin
end;
end;
procedure TCheckListBox.SetChecked(const AIndex: Integer; const AValue: Boolean);
procedure TCustomCheckListBox.SetChecked(const AIndex: Integer; const AValue: Boolean);
begin
CheckIndex(AIndex);
@ -154,15 +162,18 @@ end.
{ =============================================================================
$Log$
Revision 1.6 2004/07/13 10:34:15 mattias
fixed lcl package unit file name checklist.pas
Revision 1.5 2004/02/23 08:19:04 micha
revert intf split
Revision 1.3 2003/07/09 00:13:18 marc
* fixed cached items.object storage if TCheckListBox
* Changed DebuggerOptions dialog to use new TCheckListBox
* fixed cached items.object storage if TCustomCheckListBox
* Changed DebuggerOptions dialog to use new TCustomCheckListBox
Revision 1.2 2003/07/07 23:58:43 marc
+ Implemented TCheckListBox.Checked[] property
+ Implemented TCustomCheckListBox.Checked[] property
}

View File

@ -18,10 +18,10 @@
}
{------------------------------------------------------------------------------}
{ TButton Constructor }
{ TCustomButton Constructor }
{------------------------------------------------------------------------------}
constructor TButton.Create(TheOwner: TComponent);
constructor TCustomButton.Create(TheOwner: TComponent);
begin
Inherited Create(TheOwner);
With FShortcut do begin
@ -41,13 +41,13 @@ begin
end;
{------------------------------------------------------------------------------
Method: TButton.CreateWnd
Method: TCustomButton.CreateWnd
Params: None
Returns: Nothing
Creates the interface object.
------------------------------------------------------------------------------}
procedure TButton.CreateWnd;
procedure TCustomButton.CreateWnd;
begin
inherited CreateWnd;
//this is done in TWinControl
@ -56,18 +56,18 @@ begin
end;
{------------------------------------------------------------------------------
procedure TButton.DoSendBtnDefault;
procedure TCustomButton.DoSendBtnDefault;
------------------------------------------------------------------------------}
procedure TButton.DoSendBtnDefault;
procedure TCustomButton.DoSendBtnDefault;
begin
if HandleAllocated then
CNSendMessage(LM_BTNDEFAULT_CHANGED,Self,nil);
end;
{------------------------------------------------------------------------------
procedure TButton.ControlKeyDown
procedure TCustomButton.ControlKeyDown
------------------------------------------------------------------------------}
procedure TButton.ControlKeyDown(var Key: Word; Shift: TShiftState);
procedure TCustomButton.ControlKeyDown(var Key: Word; Shift: TShiftState);
begin
inherited ControlKeyDown(Key, Shift);
if (Key=VK_RETURN) and (Shift=[]) then begin
@ -77,9 +77,9 @@ begin
end;
{------------------------------------------------------------------------------
procedure TButton.SetParent(AParent: TWinControl);
procedure TCustomButton.SetParent(AParent: TWinControl);
------------------------------------------------------------------------------}
procedure TButton.SetParent(AParent: TWinControl);
procedure TCustomButton.SetParent(AParent: TWinControl);
var
Form: TCustomForm;
begin
@ -96,7 +96,7 @@ begin
DoSendBtnDefault;
end;
procedure TButton.UpdateRolesForForm;
procedure TCustomButton.UpdateRolesForForm;
var
AForm: TCustomForm;
NewRoles: TControlRolesForForm;
@ -114,11 +114,11 @@ begin
end;
{------------------------------------------------------------------------------
Method: TButton.SetCancel
Method: TCustomButton.SetCancel
Params: NewCancel - new cancel value
Returns: Nothing
------------------------------------------------------------------------------}
procedure TButton.SetCancel(NewCancel: boolean);
procedure TCustomButton.SetCancel(NewCancel: boolean);
var
Form: TCustomForm;
begin
@ -135,11 +135,11 @@ begin
end;
{------------------------------------------------------------------------------
Method: TButton.SetDefault
Method: TCustomButton.SetDefault
Params: Value
Returns: Nothing
------------------------------------------------------------------------------}
procedure TButton.SetDefault(Value : Boolean);
procedure TCustomButton.SetDefault(Value : Boolean);
var
Form: TCustomForm;
begin
@ -156,26 +156,26 @@ begin
DoSendBtnDefault;
end;
procedure TButton.ExecuteDefaultAction;
procedure TCustomButton.ExecuteDefaultAction;
begin
if FDefault then
Click;
end;
procedure TButton.ExecuteCancelAction;
procedure TCustomButton.ExecuteCancelAction;
begin
if FCancel then
Click;
end;
{------------------------------------------------------------------------------
Method: TButton.Click
Method: TCustomButton.Click
Params: None
Returns: Nothing
Handles the event that the button is clicked
------------------------------------------------------------------------------}
procedure TButton.Click;
procedure TCustomButton.Click;
var
Form : TCustomForm;
Begin
@ -188,18 +188,18 @@ Begin
end;
{------------------------------------------------------------------------------
Method: TButton.CMDefaultClicked
Method: TCustomButton.CMDefaultClicked
Params: None
Returns: Nothing
Handles the event when the button Leaves
------------------------------------------------------------------------------}
procedure TButton.WMDefaultClicked(var Message: TLMessage);
procedure TCustomButton.WMDefaultClicked(var Message: TLMessage);
begin
Click;
end;
procedure TButton.RealSetText(const Value: TCaption);
procedure TCustomButton.RealSetText(const Value: TCaption);
var
ParseStr : String;
AccelIndex : Longint;
@ -218,7 +218,7 @@ begin
end;
end;
function TButton.ChildClassAllowed(ChildClass: TClass): boolean;
function TCustomButton.ChildClassAllowed(ChildClass: TClass): boolean;
begin
// no childs
Result:=false;
@ -227,6 +227,9 @@ end;
{ =============================================================================
$Log$
Revision 1.32 2004/07/13 10:34:15 mattias
fixed lcl package unit file name checklist.pas
Revision 1.31 2004/07/11 13:03:54 mattias
extended RolesForForm to manage multiple roles for on control
@ -234,7 +237,7 @@ end;
form notifies control of new role
Revision 1.29 2004/07/01 20:42:11 micha
implement better ExecuteXXAction design; break dependency on TButton class in TCustomForm
implement better ExecuteXXAction design; break dependency on TCustomButton class in TCustomForm
Revision 1.28 2004/06/30 11:07:20 micha
implement return key clicks default button; escape key clicks cancel button

View File

@ -27,13 +27,12 @@ begin
ControlStyle := ControlStyle + [csCaptureMouse, csClickEvents, csSetCaption,
csDoubleClicks];
FItems := TStringList.Create;
TStringList(FItems).OnChanging := @ItemsChanged;
//TStringList(FItems).OnChanging := @ItemsChanged;
TStringList(FItems).OnChange := @ItemsChanged;
FButtonList := TList.Create;
FColumnLayout := clHorizontalThenVertical;
FColumns := 1;
Width:= 250;
Height := 200;
SetInitialBounds(0,0,250,200);
end;
destructor TCustomCheckGroup.Destroy;
@ -61,6 +60,7 @@ end;
procedure TCustomCheckGroup.DoClick(Index: integer);
begin
EditingDone;
if Assigned(OnItemClick) then OnItemClick(Self,Index);
end;
@ -134,7 +134,7 @@ var
rbWidth : integer;
MaxRows: Integer;
begin
if (FItems.Count>0) and (FColumns>0) then begin
if (FItems<>nil) and (FItems.Count>0) and (FColumns>0) then begin
// position in rows and columns
vertDist := (Height - 20) DIV (((FItems.Count-1) DIV FColumns)+1);
horzDist := (Width - 20) DIV FColumns;
@ -171,7 +171,12 @@ procedure TCustomCheckGroup.SetChecked(Index: integer; const AValue: boolean);
begin
if (Index < -1) or (Index >= FItems.Count) then
raise Exception.CreateFmt(rsIndexOutOfBounds,[ClassName,Index,FItems.Count]);
// disable OnClick
TCheckBox(FButtonList[Index]).OnClick:=nil;
// set value
TCheckBox(FButtonList[Index]).Checked:=AValue;
// enable OnClick
TCheckBox(FButtonList[Index]).OnClick:=@Clicked;
end;
procedure TCustomCheckGroup.SetItems(Value: TStrings);
@ -272,6 +277,9 @@ end;
{
$Log$
Revision 1.7 2004/07/13 10:34:15 mattias
fixed lcl package unit file name checklist.pas
Revision 1.6 2004/07/12 21:32:07 mattias
added TCheckGroup.ColumnLayout

View File

@ -321,7 +321,6 @@ Procedure TCustomRadioGroup.Clicked(Sender : TObject);
Begin
if FCreatingWnd then exit;
UpdateRadioButtonStates;
writeln('TCustomRadioGroup.Clicked A ',Name);
EditingDone;
if Assigned (FOnClick) then FOnClick(Self);
end;
@ -398,6 +397,9 @@ end;
{
$Log$
Revision 1.31 2004/07/13 10:34:15 mattias
fixed lcl package unit file name checklist.pas
Revision 1.30 2004/07/11 23:08:43 mattias
updated russian translation from vasily

View File

@ -422,6 +422,8 @@ type
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
@ -467,6 +469,8 @@ type
property OnMouseMove;
property OnMouseDown;
property OnMouseUp;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
@ -1556,6 +1560,9 @@ end.
{ =============================================================================
$Log$
Revision 1.153 2004/07/13 10:34:15 mattias
fixed lcl package unit file name checklist.pas
Revision 1.152 2004/07/10 18:17:30 mattias
added Delphi ToDo support, Application.WndProc, small bugfixes from Colin

View File

@ -896,7 +896,7 @@ begin
AddFile('extctrls.pp','ExtCtrls',pftUnit,[pffHasRegisterProc],cpBase);
AddFile('comctrls.pp','ComCtrls',pftUnit,[pffHasRegisterProc],cpBase);
AddFile('maskedit.pp','MaskEdit',pftUnit,[pffHasRegisterProc],cpBase);
AddFile('checklst.pp','CheckLst',pftUnit,[pffHasRegisterProc],cpBase);
AddFile('checklst.pas','CheckLst',pftUnit,[pffHasRegisterProc],cpBase);
AddFile('forms.pp','Forms',pftUnit,[pffHasRegisterProc],cpBase);
AddFile('grids.pas','Grids',pftUnit,[pffHasRegisterProc],cpBase);
AddFile('controls.pp','Controls',pftUnit,[pffHasRegisterProc],cpBase);