mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-01 22:20:19 +02:00
Started taking KeyDown messages in TDesigner
Shane git-svn-id: trunk@108 -
This commit is contained in:
parent
fd402e04ac
commit
176191f0cf
@ -49,11 +49,15 @@ type
|
|||||||
procedure MouseMoveOnControl(Sender : TControl; var Message : TLMessage);
|
procedure MouseMoveOnControl(Sender : TControl; var Message : TLMessage);
|
||||||
Procedure MouseUpOnControl(Sender : TControl; Message:TLMessage);
|
Procedure MouseUpOnControl(Sender : TControl; Message:TLMessage);
|
||||||
|
|
||||||
|
Procedure KeyDown(Sender : TControl; Message:TLMKEY);
|
||||||
|
Procedure RemoveControl(Control : TComponent);
|
||||||
|
|
||||||
public
|
public
|
||||||
ControlSelection : TControlSelection;
|
ControlSelection : TControlSelection;
|
||||||
constructor Create(customform : TCustomform);
|
constructor Create(customform : TCustomform);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
Procedure AddControlCode(Control : TComponent);
|
Procedure AddControlCode(Control : TComponent);
|
||||||
|
|
||||||
procedure CreateNew(FileName : string);
|
procedure CreateNew(FileName : string);
|
||||||
procedure LoadFile(FileName: string);
|
procedure LoadFile(FileName: string);
|
||||||
|
|
||||||
@ -107,8 +111,18 @@ begin
|
|||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Procedure TDesigner.RemoveControl(Control : TComponent);
|
||||||
|
Begin
|
||||||
|
Writeln('RemoveControl called');
|
||||||
|
FSourceEditor.RemoveControlCode(Control);
|
||||||
|
Control.Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TDesigner.SelectOnlyThisComponent(AComponent:TComponent);
|
procedure TDesigner.SelectOnlyThisComponent(AComponent:TComponent);
|
||||||
begin
|
begin
|
||||||
|
Writeln('Control Added '+TCOntrol(aComponent).name);
|
||||||
ControlSelection.Clear;
|
ControlSelection.Clear;
|
||||||
ControlSelection.Add(TControl(AComponent));
|
ControlSelection.Add(TControl(AComponent));
|
||||||
|
|
||||||
@ -338,6 +352,46 @@ Begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{
|
||||||
|
-----------------------------K E Y D O W N -------------------
|
||||||
|
}
|
||||||
|
{
|
||||||
|
Handles the keydown messages. DEL deletes the selected controls, CTRL-UPARROR/DOWNARROW
|
||||||
|
moves the selction up one, etc.
|
||||||
|
}
|
||||||
|
Procedure TDesigner.KeyDown(Sender : TControl; Message:TLMKEY);
|
||||||
|
var
|
||||||
|
I : Integer;
|
||||||
|
Begin
|
||||||
|
Writeln('KEYDOWN');
|
||||||
|
with MEssage do
|
||||||
|
Begin
|
||||||
|
Writeln('CHARCODE = '+inttostr(charcode));
|
||||||
|
Writeln('KEYDATA = '+inttostr(KeyData));
|
||||||
|
end;
|
||||||
|
|
||||||
|
if Message.CharCode = 46 then //DEL KEY
|
||||||
|
begin
|
||||||
|
for I := 0 to FCustomForm.ComponentCount-1 do
|
||||||
|
Begin
|
||||||
|
Writeln('I = '+inttostr(i));
|
||||||
|
if (FCustomForm.Components[i] is TControl) and
|
||||||
|
ControlSelection.IsSelected(TControl(FCustomForm.Components[i])) then
|
||||||
|
Begin
|
||||||
|
RemoveControl(TControl(FCustomForm.Components[i]));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
FFormEditor.ClearSelected;
|
||||||
|
// this will automatically inform the object inspector
|
||||||
|
ControlSelection.Add(FCustomForm);
|
||||||
|
FFormEditor.AddSelected(FCustomForm);
|
||||||
|
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TDesigner.IsDesignMsg(Sender: TControl; var Message: TLMessage): Boolean;
|
function TDesigner.IsDesignMsg(Sender: TControl; var Message: TLMessage): Boolean;
|
||||||
Begin
|
Begin
|
||||||
result := false;
|
result := false;
|
||||||
@ -347,6 +401,7 @@ else
|
|||||||
if ((Message.msg >= LM_KeyFIRST) and (Message.msg <= LM_KeyLAST)) then
|
if ((Message.msg >= LM_KeyFIRST) and (Message.msg <= LM_KeyLAST)) then
|
||||||
Begin
|
Begin
|
||||||
Writeln('KEY MESSAGE in IsDesignMsg');
|
Writeln('KEY MESSAGE in IsDesignMsg');
|
||||||
|
KeyDown(Sender,TLMKey(Message));
|
||||||
Result := true;
|
Result := true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
12
ide/main.pp
12
ide/main.pp
@ -182,7 +182,7 @@ type
|
|||||||
Function ReturnFormName(Source : TStringList) : String;
|
Function ReturnFormName(Source : TStringList) : String;
|
||||||
|
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
procedure LoadMainMenu;
|
procedure LoadMainMenu;
|
||||||
Procedure FormKill(Sender : TObject);
|
Procedure FormKill(Sender : TObject);
|
||||||
Procedure SetFlags(SLIst : TUnitInfo);
|
Procedure SetFlags(SLIst : TUnitInfo);
|
||||||
@ -223,7 +223,8 @@ uses
|
|||||||
|
|
||||||
{ TMainIDE }
|
{ TMainIDE }
|
||||||
|
|
||||||
constructor TMainIDE.Create(AOwner: TComponent);
|
|
||||||
|
constructor TMainIDE.Create(AOwner: TComponent);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1572,6 +1573,7 @@ If TSourceEditor(Sender).IsControlUnit then
|
|||||||
// Writeln('Result = '+Inttostr(CreateLFM(ViewForms1)));
|
// Writeln('Result = '+Inttostr(CreateLFM(ViewForms1)));
|
||||||
// Writeln('Result = '+Inttostr(CreateLFM(MessageDlg)));
|
// Writeln('Result = '+Inttostr(CreateLFM(MessageDlg)));
|
||||||
// Writeln('Result = '+Inttostr(CreateLFM(FindDialog1)));
|
// Writeln('Result = '+Inttostr(CreateLFM(FindDialog1)));
|
||||||
|
Writeln('Result = '+Inttostr(CreateLFM(MainIDE)));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1881,6 +1883,8 @@ initialization
|
|||||||
{$I dlgmessage.lrs}
|
{$I dlgmessage.lrs}
|
||||||
{$I viewunits1.lrs}
|
{$I viewunits1.lrs}
|
||||||
{$I viewforms1.lrs}
|
{$I viewforms1.lrs}
|
||||||
|
{ $I mainide.lrs}
|
||||||
|
{ $I finddialog1.lrs}
|
||||||
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
@ -1890,6 +1894,10 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.38 2001/01/09 21:06:06 lazarus
|
||||||
|
Started taking KeyDown messages in TDesigner
|
||||||
|
Shane
|
||||||
|
|
||||||
Revision 1.37 2001/01/09 18:23:20 lazarus
|
Revision 1.37 2001/01/09 18:23:20 lazarus
|
||||||
Worked on moving controls. It's just not working with the X and Y coord's I'm getting.
|
Worked on moving controls. It's just not working with the X and Y coord's I'm getting.
|
||||||
Shane
|
Shane
|
||||||
|
@ -104,6 +104,7 @@ type
|
|||||||
constructor Create(AOwner : TComponent; AParent : TWinControl);
|
constructor Create(AOwner : TComponent; AParent : TWinControl);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
Procedure AddControlCode(_Control : TComponent);
|
Procedure AddControlCode(_Control : TComponent);
|
||||||
|
Procedure RemoveControlCode(_Control : TComponent);
|
||||||
Procedure SelectText(LineNum,CharStart,LineNum2,CharEnd : Integer);
|
Procedure SelectText(LineNum,CharStart,LineNum2,CharEnd : Integer);
|
||||||
Procedure KeyPressed(Sender : TObject; var key: char);
|
Procedure KeyPressed(Sender : TObject; var key: char);
|
||||||
Procedure CreateFormUnit(AForm : TCustomForm);
|
Procedure CreateFormUnit(AForm : TCustomForm);
|
||||||
@ -456,6 +457,49 @@ For I := 0 to TempSource.Count-1 do
|
|||||||
Source := TempSource;
|
Source := TempSource;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{Called when a control is deleted from the form}
|
||||||
|
Procedure TSourceEditor.RemoveControlCode(_Control : TComponent);
|
||||||
|
var
|
||||||
|
PT : PTypeData;
|
||||||
|
PI : PTypeInfo;
|
||||||
|
nmControlType : String;
|
||||||
|
I : Integer;
|
||||||
|
NewSource : String;
|
||||||
|
TempSource : TStringList;
|
||||||
|
Ancestor : String;
|
||||||
|
begin
|
||||||
|
TempSource := TStringList.Create;
|
||||||
|
TempSource.Assign(Source);
|
||||||
|
|
||||||
|
//get the control name
|
||||||
|
PI := _Control.ClassInfo;
|
||||||
|
nmControlType := _Control.name;
|
||||||
|
Ancestor := GetAncestor;
|
||||||
|
|
||||||
|
//find the place in the code to start looking for it
|
||||||
|
|
||||||
|
For I := 0 to TempSource.Count-1 do
|
||||||
|
if (pos(Ancestor,TempSource.Strings[i]) <> 0) and (pos(TWinControl(_Control.Owner).Name,TempSource.Strings[i]) <> 0) and (pos('CLASS',Uppercase(TempSource.Strings[i])) <> 0) then
|
||||||
|
Break;
|
||||||
|
|
||||||
|
//if I => FSource.Count then I didn't find the line...
|
||||||
|
If I < TempSource.Count then
|
||||||
|
Begin
|
||||||
|
//alphabetical
|
||||||
|
inc(i);
|
||||||
|
NewSource := _Control.Name+' : '+nmControlType+';';
|
||||||
|
|
||||||
|
while NewSource < (trim(TempSource.Strings[i])) do
|
||||||
|
inc(i);
|
||||||
|
|
||||||
|
If NewSource = (trim(TempSource.Strings[i])) then
|
||||||
|
TempSource.Delete(I);
|
||||||
|
end;
|
||||||
|
Source := TempSource;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
Procedure TSourceEditor.DisplayControl;
|
Procedure TSourceEditor.DisplayControl;
|
||||||
Begin
|
Begin
|
||||||
if FControl = nil then Exit;
|
if FControl = nil then Exit;
|
||||||
|
@ -186,16 +186,17 @@ type
|
|||||||
constructor Create(AOwner : TCOmponent) ; override;
|
constructor Create(AOwner : TCOmponent) ; override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure Click; override;
|
procedure Click; override;
|
||||||
property Glyph : TBitmap read GetGlyph write SetGlyph;
|
|
||||||
published
|
published
|
||||||
property AllowAllUp : Boolean read FAllowAllUp write SetAllowAllUp default false;
|
property AllowAllUp : Boolean read FAllowAllUp write SetAllowAllUp default false;
|
||||||
property Down : Boolean read FDown write SetDown default False;
|
property Down : Boolean read FDown write SetDown default False;
|
||||||
property Enabled;
|
property Enabled;
|
||||||
property Flat : Boolean read FFlat write SetFlat default False;
|
property Flat : Boolean read FFlat write SetFlat default False;
|
||||||
|
property Glyph : TBitmap read GetGlyph write SetGlyph;
|
||||||
property GroupIndex : Integer read FGroupIndex write SetGroupIndex default 0;
|
property GroupIndex : Integer read FGroupIndex write SetGroupIndex default 0;
|
||||||
property NumGlyphs : Integer read GetNumGlyphs write SetNumGlyphs default 1;
|
property NumGlyphs : Integer read GetNumGlyphs write SetNumGlyphs default 1;
|
||||||
property Transparent : Boolean read FTransparent write FTransparent default false;
|
property Transparent : Boolean read FTransparent write FTransparent default false;
|
||||||
property Visible;
|
property Visible;
|
||||||
|
property OnClick;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -234,6 +235,10 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.7 2001/01/09 21:06:06 lazarus
|
||||||
|
Started taking KeyDown messages in TDesigner
|
||||||
|
Shane
|
||||||
|
|
||||||
Revision 1.6 2001/01/03 18:44:54 lazarus
|
Revision 1.6 2001/01/03 18:44:54 lazarus
|
||||||
The Speedbutton now has a numglyphs setting.
|
The Speedbutton now has a numglyphs setting.
|
||||||
I started the TStringPropertyEditor
|
I started the TStringPropertyEditor
|
||||||
|
@ -159,6 +159,7 @@ type
|
|||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
property Page;
|
||||||
published
|
published
|
||||||
property ActivePage;
|
property ActivePage;
|
||||||
property PageIndex;
|
property PageIndex;
|
||||||
@ -323,6 +324,10 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.6 2001/01/09 21:06:06 lazarus
|
||||||
|
Started taking KeyDown messages in TDesigner
|
||||||
|
Shane
|
||||||
|
|
||||||
Revision 1.5 2001/01/09 18:23:20 lazarus
|
Revision 1.5 2001/01/09 18:23:20 lazarus
|
||||||
Worked on moving controls. It's just not working with the X and Y coord's I'm getting.
|
Worked on moving controls. It's just not working with the X and Y coord's I'm getting.
|
||||||
Shane
|
Shane
|
||||||
|
Loading…
Reference in New Issue
Block a user