mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2026-01-07 20:30:28 +01:00
changed the TCOmponentInterface SetPropByName. It works for a few properties, but not all.
Shane git-svn-id: trunk@55 -
This commit is contained in:
parent
e61c62fb5a
commit
3952fe23db
@ -383,11 +383,12 @@ Begin
|
||||
Writeln('*************');
|
||||
Writeln('SetPropByName');
|
||||
Result := False;
|
||||
PRI := GetPPropInfoByName(Uppercase(Name));
|
||||
{ PRI := GetPPropInfoByName(Uppercase(Name));
|
||||
Writeln('Back from GetPPropInfobyName');
|
||||
if PRI <> nil then
|
||||
with PRI^ do
|
||||
Begin
|
||||
if kind = tkBool then Writeln('111111111111111');
|
||||
if SetProc <> nil then
|
||||
Begin //call the procedure passing Value
|
||||
Writeln('Assigning the procedure');
|
||||
@ -397,7 +398,28 @@ Writeln('SetPropByName');
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
}
|
||||
PRI := GetPropInfo(FControl.ClassInfo,Name);
|
||||
if PRI <> nil then
|
||||
Begin
|
||||
if PRI^.Proptype^.kind = tkBool then Writeln('111111111111111');
|
||||
case PRI^.PropType^.Kind of
|
||||
tkBool: SetOrdProp(FControl,PRI,longint(Value));
|
||||
tkSString,
|
||||
tkLString,
|
||||
tkAString,
|
||||
tkWString : Begin
|
||||
Writeln('String...');
|
||||
SetStrProp(FControl,PRI,String(Value));
|
||||
end;
|
||||
tkInteger,
|
||||
tkInt64 : Begin
|
||||
Writeln('Int64...');
|
||||
SetInt64Prop(FControl,PRI,Int64(Value));
|
||||
end;
|
||||
|
||||
end;//case
|
||||
end;
|
||||
Writeln('SetPropByName Exiting...');
|
||||
Writeln('*************');
|
||||
end;
|
||||
|
||||
@ -23,7 +23,7 @@ unit global;
|
||||
|
||||
interface
|
||||
uses
|
||||
Classes,designerform,sysutils;
|
||||
Classes,sysutils;
|
||||
|
||||
type
|
||||
TPRojFlags = (pfProject, pfForm, pfSource, pfNone);
|
||||
@ -36,7 +36,7 @@ type
|
||||
FFlags : TProjFlags;
|
||||
FSource : TStringList;
|
||||
FPage : Integer;
|
||||
FForm : TDesignerForm;
|
||||
// FForm : TDesignerForm;
|
||||
Procedure SetFormName(Value : String);
|
||||
Function GetFormName : String;
|
||||
Procedure SetPage(Value : Integer);
|
||||
@ -53,7 +53,7 @@ type
|
||||
Property Page : Integer read GetPage write SetPage;
|
||||
Property FileName : String read FFileName write FFilename;
|
||||
Property Flags : TProjFlags read FFlags write FFLags;
|
||||
property Form : TDesignerForm read fform write fform;
|
||||
// property Form : TDesignerForm read fform write fform;
|
||||
|
||||
end;
|
||||
|
||||
@ -73,6 +73,10 @@ end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.2 2000/12/01 15:50:39 lazarus
|
||||
changed the TCOmponentInterface SetPropByName. It works for a few properties, but not all.
|
||||
Shane
|
||||
|
||||
Revision 1.1 2000/07/13 10:27:47 michael
|
||||
+ Initial import
|
||||
|
||||
|
||||
74
ide/main.pp
74
ide/main.pp
@ -1088,52 +1088,7 @@ end;
|
||||
|
||||
|
||||
Function TForm1.Create_LFM(SList : TUnitInfo) : Boolean;
|
||||
var
|
||||
F : TStringlist;
|
||||
I,Count : Integer;
|
||||
Spacer : String;
|
||||
Form : TForm;
|
||||
aControl : TControl;
|
||||
Begin
|
||||
Writeln('SAVING LFM FILE*************');
|
||||
F := TStringlist.Create;
|
||||
Count := 0;
|
||||
Spacer := ' ';
|
||||
Form := SLIst.Form;
|
||||
F.Add(spacer+'Object '+Form.Name+': TForm');
|
||||
Spacer := ' ';
|
||||
inc(count);
|
||||
F.Add(spacer+'Left = '+inttostr(Form.Left));
|
||||
F.Add(spacer+'Top = '+inttostr(Form.Top));
|
||||
F.Add(spacer+'Width = '+inttostr(Form.Width));
|
||||
F.Add(spacer+'Height = '+inttostr(Form.Height));
|
||||
F.Add(spacer+'Caption = '+Form.Caption);
|
||||
//walk through the controls on the form and the controls on the controls...
|
||||
for i := 0 to Form.ControlCount-1 do
|
||||
Begin
|
||||
Spacer := '';
|
||||
while length (spacer) < 2*(I+2) do
|
||||
Spacer := Spacer + ' ';
|
||||
aControl := Form.Controls[i];
|
||||
F.Add(Spacer+'Object '+aControl.Name+': '+aControl.Classname);
|
||||
F.Add(Spacer+' Left = '+inttostr(aControl.Left));
|
||||
F.Add(Spacer+' Top = '+inttostr(aControl.Top));
|
||||
F.Add(Spacer+' Width = '+inttostr(aControl.Width));
|
||||
F.Add(Spacer+' Height = '+inttostr(aControl.Height));
|
||||
F.Add(Spacer+' Text = '+aControl.Text);
|
||||
|
||||
end;
|
||||
|
||||
Spacer := '';
|
||||
for I := 0 to count-1 do
|
||||
begin
|
||||
while length (spacer) < 2*I do
|
||||
Spacer := Spacer + ' ';
|
||||
F.Add(spacer+'end');
|
||||
end;
|
||||
|
||||
F.SaveToFile(ExtractFilePath(Slist.Filename)+SList.FormName+'.lfm');
|
||||
F.Free;
|
||||
end;
|
||||
|
||||
Function TForm1.SavebyUnit(SList : TUnitInfo) : Boolean;
|
||||
@ -1510,16 +1465,8 @@ var
|
||||
NewLeft1, NewTop1 : Integer;
|
||||
NewLeft2, NewTop2 : Integer;
|
||||
Begin
|
||||
Writeln('Mouse up at '+inttostr(x)+' '+inttostr(y));
|
||||
Writeln('LEft is'+inttostr(left));
|
||||
Writeln('Top is'+inttostr(Top));
|
||||
Writeln('Width is'+inttostr(Width));
|
||||
Writeln('Height is'+inttostr(Height));
|
||||
Writeln('------');
|
||||
Writeln('senders LEft is'+inttostr(TControl(Sender).left));
|
||||
Writeln('Top is'+inttostr(TControl(Sender).Top));
|
||||
Writeln('Width is'+inttostr(TControl(Sender).Width));
|
||||
Writeln('Height is'+inttostr(TControl(Sender).Height));
|
||||
|
||||
//see if they moved the mouse or simply clicked on the form
|
||||
if (X >= 0) and (X <= TControl(sender).Width) and
|
||||
(Y >= 0) and (Y <= TControl(sender).Height) then
|
||||
begin
|
||||
@ -1567,10 +1514,17 @@ if (X >= 0) and (X <= TControl(sender).Width) and
|
||||
else
|
||||
CInterface := TComponentInterface(FormEditor1.CreateComponent(nil,
|
||||
TComponentClass(TIdeComponent(ideComplist.items[bpressed-1]).ClassType),Mouse_Down.X,Mouse_Down.Y,-1,-1));
|
||||
// CInterface.Setpropbyname('Visible',True);//Control).Visible := True;
|
||||
|
||||
{Set up some default values for the control here}
|
||||
{ CInterface is a TComponentInterface defined in CustomFormEditor.pp}
|
||||
CInterface.SetPropByName('VISIBLE',True);
|
||||
// CInterface.SetPropByName('NAME','PLEASEWORK1');
|
||||
// CInterface.SetPropbyName('CAPTION','Click me!');
|
||||
CInterface.SetPropByName('HINT','Click');
|
||||
CInterface.SetPropbyName('TOP',10);
|
||||
|
||||
|
||||
//set the ONCLICK event so we know when the control is selected;
|
||||
TControl(CInterface.Control).Visible := True;
|
||||
TControl(CInterface.Control).OnClick := @ClickOnControl;
|
||||
FormEditor1.ClearSelected;
|
||||
FormEditor1.AddSelected(TComponent(Cinterface.Control));
|
||||
@ -2193,10 +2147,8 @@ end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.13 2000/11/30 21:43:38 lazarus
|
||||
Changed TDesigner. It's now notified when a control is added to it's CustomForm.
|
||||
It's created in main.pp when New Form is selected.
|
||||
|
||||
Revision 1.14 2000/12/01 15:50:39 lazarus
|
||||
changed the TCOmponentInterface SetPropByName. It works for a few properties, but not all.
|
||||
Shane
|
||||
|
||||
Revision 1.5 2000/08/10 13:22:51 lazarus
|
||||
|
||||
@ -65,6 +65,7 @@ type
|
||||
property Default : Boolean read FDefault write SetDefault default false;
|
||||
property ModalResult : TModalResult read FModalResult write FModalResult default 0;
|
||||
property Cancel : Boolean read FCancel write FCancel default False;
|
||||
property Caption;
|
||||
property Font;
|
||||
|
||||
property Visible;
|
||||
@ -72,7 +73,7 @@ type
|
||||
property OnExit;
|
||||
property OnKeyDown;
|
||||
property OnKeyPress;
|
||||
// property OnKeyUp;
|
||||
property OnKeyUp;
|
||||
property OnMouseDown;
|
||||
property OnMouseMove;
|
||||
property OnMouseUp;
|
||||
@ -212,6 +213,10 @@ end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.4 2000/12/01 15:50:39 lazarus
|
||||
changed the TCOmponentInterface SetPropByName. It works for a few properties, but not all.
|
||||
Shane
|
||||
|
||||
Revision 1.3 2000/11/29 21:22:35 lazarus
|
||||
New Object Inspector code
|
||||
Shane
|
||||
|
||||
@ -545,10 +545,10 @@ TCMDialogKey = TLMKEY;
|
||||
property WindowProc: TWndMethod read FWindowProc write FWindowProc;
|
||||
published
|
||||
property Left: Integer read FLeft write SetLeft;
|
||||
property Top: Integer read FTop write SetTop;
|
||||
property Height: Integer read FHeight write SetHeight;
|
||||
property Width: Integer read FWidth write SetWidth;
|
||||
property Hint: String read FHint write SetHint;
|
||||
property Top: Integer read FTop write SetTop;
|
||||
property Width: Integer read FWidth write SetWidth;
|
||||
end;
|
||||
|
||||
TLMEnter = TLMNoPara;
|
||||
@ -1123,6 +1123,10 @@ end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.6 2000/12/01 15:50:39 lazarus
|
||||
changed the TCOmponentInterface SetPropByName. It works for a few properties, but not all.
|
||||
Shane
|
||||
|
||||
Revision 1.5 2000/11/30 21:43:38 lazarus
|
||||
Changed TDesigner. It's now notified when a control is added to it's CustomForm.
|
||||
It's created in main.pp when New Form is selected.
|
||||
|
||||
@ -229,6 +229,7 @@ type
|
||||
property Lines;
|
||||
property ReadOnly;
|
||||
property Tabstop;
|
||||
property Visible;
|
||||
property OnChange;
|
||||
end;
|
||||
|
||||
@ -476,6 +477,10 @@ end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.4 2000/12/01 15:50:39 lazarus
|
||||
changed the TCOmponentInterface SetPropByName. It works for a few properties, but not all.
|
||||
Shane
|
||||
|
||||
Revision 1.3 2000/11/29 21:22:35 lazarus
|
||||
New Object Inspector code
|
||||
Shane
|
||||
|
||||
Loading…
Reference in New Issue
Block a user