mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-05 19:18:35 +02:00
MG: finished TComponentPropertyEditor, added OnModified to oi, cfe and designer
git-svn-id: trunk@255 -
This commit is contained in:
parent
ff15c0780a
commit
68ebd85421
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -92,9 +92,6 @@ ide/splash.pp svneol=native#text/pascal
|
||||
ide/testform.pp svneol=native#text/pascal
|
||||
ide/transfermacros.pp svneol=native#text/pascal
|
||||
ide/uniteditor.pp svneol=native#text/pascal
|
||||
ide/viewform_dlg.lfm svneol=native#text/plain
|
||||
ide/viewform_dlg.pp svneol=native#text/pascal
|
||||
ide/viewforms1.lrs svneol=native#text/pascal
|
||||
ide/viewunit_dlg.lfm svneol=native#text/plain
|
||||
ide/viewunit_dlg.pp svneol=native#text/pascal
|
||||
ide/viewunits1.lrs svneol=native#text/pascal
|
||||
|
@ -53,6 +53,7 @@ type
|
||||
FOnComponentListChanged: TNotifyEvent;
|
||||
FOnGetSelectedComponentClass: TOnGetSelectedComponentClass;
|
||||
FOnGetNonVisualCompIconCanvas: TOnGetNonVisualCompIconCanvas;
|
||||
FOnModified: TNotifyEvent;
|
||||
FOnPropertiesChanged: TNotifyEvent;
|
||||
FOnRemoveComponent: TOnRemoveComponent;
|
||||
FOnSetDesigning: TOnSetDesigning;
|
||||
@ -108,18 +109,19 @@ type
|
||||
property Form: TCustomForm read FCustomForm write FCustomForm;
|
||||
property FormEditor : TFormEditor read FFormEditor write FFormEditor;
|
||||
property SourceEditor : TSourceEditor read FSourceEditor write FSourceEditor;
|
||||
property OnGetSelectedComponentClass: TOnGetSelectedComponentClass
|
||||
read FOnGetSelectedComponentClass write FOnGetSelectedComponentClass;
|
||||
property OnUnselectComponentClass: TNotifyEvent
|
||||
read FOnUnselectComponentClass write FOnUnselectComponentClass;
|
||||
property OnSetDesigning: TOnSetDesigning read FOnSetDesigning write FOnSetDesigning;
|
||||
property OnAddComponent: TOnAddComponent read FOnAddComponent write FOnAddComponent;
|
||||
property OnComponentListChanged: TNotifyEvent
|
||||
read FOnComponentListChanged write FOnComponentListChanged;
|
||||
property OnGetSelectedComponentClass: TOnGetSelectedComponentClass
|
||||
read FOnGetSelectedComponentClass write FOnGetSelectedComponentClass;
|
||||
property OnModified: TNotifyEvent read FOnModified write FOnModified;
|
||||
property OnPropertiesChanged: TNotifyEvent
|
||||
read FOnPropertiesChanged write FOnPropertiesChanged;
|
||||
property OnAddComponent: TOnAddComponent read FOnAddComponent write FOnAddComponent;
|
||||
property OnRemoveComponent: TOnRemoveComponent
|
||||
read FOnRemoveComponent write FOnRemoveComponent;
|
||||
property OnSetDesigning: TOnSetDesigning read FOnSetDesigning write FOnSetDesigning;
|
||||
property OnUnselectComponentClass: TNotifyEvent
|
||||
read FOnUnselectComponentClass write FOnUnselectComponentClass;
|
||||
function NonVisualComponentAtPos(x,y: integer): TComponent;
|
||||
procedure DrawNonVisualComponents(DC: HDC);
|
||||
property OnGetNonVisualCompIconCanvas: TOnGetNonVisualCompIconCanvas
|
||||
@ -680,7 +682,8 @@ end;
|
||||
|
||||
procedure TDesigner.Modified;
|
||||
Begin
|
||||
|
||||
ControlSelection.SaveBounds;
|
||||
if Assigned(FOnModified) then FOnModified(Self);
|
||||
end;
|
||||
|
||||
procedure TDesigner.Notification(AComponent: TComponent; Operation: TOperation);
|
||||
|
@ -131,6 +131,7 @@ type
|
||||
FCurrentButton:TWinControl; // nil or ValueButton
|
||||
FDragging:boolean;
|
||||
FOldMouseDownY:integer; // XXX workaround
|
||||
FOnModified: TNotifyEvent;
|
||||
FExpandedProperties:TStringList;
|
||||
FBorderStyle:TBorderStyle;
|
||||
|
||||
@ -212,6 +213,7 @@ type
|
||||
procedure MouseUp(Button:TMouseButton; Shift:TShiftState; X,Y:integer); override;
|
||||
function MouseToIndex(y:integer;MustExist:boolean):integer;
|
||||
|
||||
property OnModified: TNotifyEvent read FOnModified write FOnModified;
|
||||
procedure SetBounds(aLeft,aTop,aWidth,aHeight:integer); override;
|
||||
procedure Paint; override;
|
||||
procedure Clear;
|
||||
@ -243,11 +245,13 @@ type
|
||||
FUpdatingAvailComboBox:boolean;
|
||||
FOnAddAvailableComponent:TOnAddAvailableComponent;
|
||||
FOnSelectComponentInOI:TOnSelectComponentInOI;
|
||||
FOnModified: TNotifyEvent;
|
||||
function ComponentToString(c:TComponent):string;
|
||||
procedure SetPropertyEditorHook(NewValue:TPropertyEditorHook);
|
||||
procedure SetSelections(const NewSelections:TComponentSelectionList);
|
||||
procedure AddComponentToAvailComboBox(AComponent:TComponent);
|
||||
procedure PropEditLookupRootChange;
|
||||
procedure OnGridModified(Sender: TObject);
|
||||
public
|
||||
procedure SetBounds(aLeft,aTop,aWidth,aHeight:integer); override;
|
||||
property Selections:TComponentSelectionList
|
||||
@ -261,6 +265,7 @@ type
|
||||
read FOnSelectComponentInOI write FOnSelectComponentInOI;
|
||||
property PropertyEditorHook:TPropertyEditorHook
|
||||
read FPropertyEditorHook write SetPropertyEditorHook;
|
||||
property OnModified: TNotifyEvent read FOnModified write FOnModified;
|
||||
procedure DoInnerResize;
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
@ -512,8 +517,10 @@ begin
|
||||
try
|
||||
CurRow.Editor.SetValue(NewValue);
|
||||
except
|
||||
writeln('[TOIPropertyGrid.SetRowValue] OH NO');
|
||||
on E: Exception do
|
||||
MessageDlg(E.Message,mtError,[mbOk],0);
|
||||
end;
|
||||
if Assigned(FOnModified) then FOnModified(Self);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -1434,6 +1441,7 @@ begin
|
||||
Selections:=Self.FComponentList;
|
||||
Align:=alClient;
|
||||
PopupMenu:=MainPopupMenu;
|
||||
OnModified:=@OnGridModified;
|
||||
Show;
|
||||
end;
|
||||
|
||||
@ -1448,6 +1456,7 @@ begin
|
||||
Selections:=Self.FComponentList;
|
||||
Align:=alClient;
|
||||
PopupMenu:=MainPopupMenu;
|
||||
OnModified:=@OnGridModified;
|
||||
Show;
|
||||
end;
|
||||
|
||||
@ -1628,5 +1637,10 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TObjectInspector.OnGridModified(Sender: TObject);
|
||||
begin
|
||||
if Assigned(FOnModified) then FOnModified(Self);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
@ -20,7 +20,7 @@ unit propedits;
|
||||
-StrToInt64 has a bug. It prints infinitly "something happened"
|
||||
-> taking my own
|
||||
-TFont property editors
|
||||
-Message Dialogoues on errors
|
||||
-Message Dialogs on errors
|
||||
|
||||
-many more... see XXX
|
||||
}
|
||||
@ -2252,19 +2252,22 @@ end;
|
||||
|
||||
procedure TComponentPropertyEditor.GetValues(Proc: TGetStringProc);
|
||||
begin
|
||||
PropertyHook.GetComponentNames(GetTypeData(GetPropType), Proc);
|
||||
if Assigned(PropertyHook) then
|
||||
PropertyHook.GetComponentNames(GetTypeData(GetPropType), Proc);
|
||||
end;
|
||||
|
||||
procedure TComponentPropertyEditor.SetValue(const NewValue: ansistring);
|
||||
var Component: TComponent;
|
||||
begin
|
||||
if NewValue = '' then Component := nil else
|
||||
begin
|
||||
Component := PropertyHook.GetComponent(NewValue);
|
||||
if not (Component is GetTypeData(GetPropType)^.ClassType) then begin
|
||||
// XXX
|
||||
//raise EPropertyError.CreateRes(@SInvalidPropertyValue);
|
||||
exit;
|
||||
if NewValue = '' then Component := nil
|
||||
else begin
|
||||
if Assigned(PropertyHook) then begin
|
||||
Component := PropertyHook.GetComponent(NewValue);
|
||||
if not (Component is GetTypeData(GetPropType)^.ClassType) then begin
|
||||
// XXX
|
||||
//raise EPropertyError.CreateRes(@SInvalidPropertyValue);
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
SetOrdValue(Longint(Component));
|
||||
@ -2895,8 +2898,13 @@ function TPropertyEditorHook.GetComponent(const Name:Shortstring):TComponent;
|
||||
begin
|
||||
if Assigned(FOnGetComponent) then
|
||||
Result:=FOnGetComponent(Name)
|
||||
else
|
||||
Result:=nil;
|
||||
else begin
|
||||
if Assigned(LookupRoot) then begin
|
||||
Result:=LookupRoot.FindComponent(Name);
|
||||
end else begin
|
||||
Result:=nil;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TPropertyEditorHook.GetComponentName(
|
||||
@ -2914,9 +2922,16 @@ end;
|
||||
|
||||
procedure TPropertyEditorHook.GetComponentNames(TypeData:PTypeData;
|
||||
Proc:TGetStringProc);
|
||||
var i: integer;
|
||||
begin
|
||||
if Assigned(FOnGetComponentNames) then
|
||||
FOnGetComponentNames(TypeData,Proc);
|
||||
FOnGetComponentNames(TypeData,Proc)
|
||||
else begin
|
||||
if Assigned(LookupRoot) then
|
||||
for i:=0 to LookupRoot.ComponentCount-1 do
|
||||
if (LookupRoot.Components[i] is TypeData^.ClassType) then
|
||||
Proc(LookupRoot.Components[i].Name);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TPropertyEditorHook.GetRootClassName:Shortstring;
|
||||
@ -3031,7 +3046,7 @@ begin
|
||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TPenStyle'),
|
||||
nil,'',TPenStylePropertyEditor);
|
||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('longint'),
|
||||
nil,'',TTabOrderPropertyEditor);
|
||||
nil,'Tag',TTabOrderPropertyEditor);
|
||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('shortstring'),
|
||||
nil,'',TCaptionPropertyEditor);
|
||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TStrings'),
|
||||
|
@ -99,6 +99,8 @@ TCustomFormEditor
|
||||
protected
|
||||
Procedure RemoveFromComponentInterfaceList(Value :TIComponentInterface);
|
||||
procedure SetSelectedComponents(TheSelectedComponents : TComponentSelectionList);
|
||||
procedure OnObjectInspectorModified(Sender: TObject);
|
||||
procedure SetObj_Inspector(AnObjectInspector: TObjectInspector);
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
@ -118,7 +120,7 @@ TCustomFormEditor
|
||||
Procedure ClearSelected;
|
||||
property SelectedComponents : TComponentSelectionList
|
||||
read FSelectedComponents write SetSelectedComponents;
|
||||
property Obj_Inspector : TObjectInspector read FObj_Inspector write FObj_Inspector;
|
||||
property Obj_Inspector : TObjectInspector read FObj_Inspector write SetObj_Inspector;
|
||||
end;
|
||||
|
||||
|
||||
@ -517,15 +519,17 @@ end;
|
||||
procedure TCustomFormEditor.SetSelectedComponents(
|
||||
TheSelectedComponents : TComponentSelectionList);
|
||||
begin
|
||||
if FSelectedComponents.Count>0 then begin
|
||||
if FSelectedComponents[0].Owner<>nil then begin
|
||||
Obj_Inspector.PropertyEditorHook.LookupRoot:=
|
||||
FSelectedComponents[0].Owner;
|
||||
end else begin
|
||||
Obj_Inspector.PropertyEditorHook.LookupRoot:=FSelectedComponents[0];
|
||||
end;
|
||||
end;
|
||||
if FSelectedComponents.IsEqual(TheSelectedComponents) then exit;
|
||||
FSelectedComponents.Free;
|
||||
FSelectedComponents:=TheSelectedComponents;
|
||||
if FSelectedComponents.Count>0 then begin
|
||||
Obj_Inspector.PropertyEditorHook.LookupRoot:=
|
||||
FSelectedComponents[0].Owner;
|
||||
end else begin
|
||||
Obj_Inspector.PropertyEditorHook.LookupRoot:=nil;
|
||||
end;
|
||||
Obj_Inspector.Selections := FSelectedComponents;
|
||||
end;
|
||||
|
||||
@ -705,18 +709,17 @@ begin
|
||||
Result := Temp;
|
||||
end;
|
||||
|
||||
Procedure TCustomFormEditor.RemoveFromComponentInterfaceList(Value :TIComponentInterface);
|
||||
Procedure TCustomFormEditor.RemoveFromComponentInterfaceList(
|
||||
Value :TIComponentInterface);
|
||||
Begin
|
||||
if (FComponentInterfaceList.IndexOf(Value) <> -1) then
|
||||
FComponentInterfaceList.Delete(FComponentInterfaceList.IndexOf(Value));
|
||||
|
||||
end;
|
||||
|
||||
|
||||
Function TCustomFormEditor.GetFormComponent : TIComponentInterface;
|
||||
Begin
|
||||
//this can only be used IF you have one FormEditor per form. I currently don't
|
||||
result := nil;
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
Procedure TCustomFormEditor.ClearSelected;
|
||||
@ -724,7 +727,8 @@ Begin
|
||||
FSelectedComponents.Clear;
|
||||
end;
|
||||
|
||||
Function TCustomFormEditor.CreateControlComponentInterface(Control: TComponent) :TIComponentInterface;
|
||||
Function TCustomFormEditor.CreateControlComponentInterface(
|
||||
Control: TComponent) :TIComponentInterface;
|
||||
var
|
||||
Temp : TComponentInterface;
|
||||
|
||||
@ -733,7 +737,31 @@ Begin
|
||||
Temp.FControl := Control;
|
||||
FComponentInterfaceList.Add(Temp);
|
||||
Result := Temp;
|
||||
end;
|
||||
|
||||
procedure TCustomFormEditor.OnObjectInspectorModified(Sender: TObject);
|
||||
var CustomForm: TCustomForm;
|
||||
begin
|
||||
if (FSelectedComponents<>nil) and (FSelectedComponents.Count>0) then begin
|
||||
if FSelectedComponents[0] is TCustomForm then
|
||||
CustomForm:=TCustomForm(FSelectedComponents[0])
|
||||
else if (FSelectedComponents[0].Owner<>nil)
|
||||
and (FSelectedComponents[0].Owner is TCustomForm) then
|
||||
CustomForm:=TCustomForm(FSelectedComponents[0].Owner)
|
||||
else
|
||||
CustomForm:=nil;
|
||||
if (CustomForm<>nil) and (CustomForm.Designer<>nil) then
|
||||
CustomForm.Designer.Modified;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomFormEditor.SetObj_Inspector(
|
||||
AnObjectInspector: TObjectInspector);
|
||||
begin
|
||||
if AnObjectInspector=FObj_Inspector then exit;
|
||||
if FObj_Inspector<>nil then FObj_Inspector.OnModified:=nil;
|
||||
FObj_Inspector:=AnObjectInspector;
|
||||
FObj_Inspector.OnModified:=@OnObjectInspectorModified;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
17
ide/main.pp
17
ide/main.pp
@ -268,6 +268,7 @@ type
|
||||
procedure OnDesignerAddComponent(Sender: TObject; Component: TComponent;
|
||||
ComponentClass: TRegisteredComponent);
|
||||
procedure OnDesignerRemoveComponent(Sender: TObject; Component: TComponent);
|
||||
procedure OnDesignerModified(Sender: TObject);
|
||||
procedure OnControlSelectionChanged(Sender: TObject);
|
||||
|
||||
procedure SaveDesktopSettings(TheEnvironmentOptions: TEnvironmentOptions);
|
||||
@ -1376,6 +1377,7 @@ writeln('[TMainIDE.SetDefaultsforForm] 2');
|
||||
OnAddComponent:=@OnDesignerAddComponent;
|
||||
OnRemoveComponent:=@OnDesignerRemoveComponent;
|
||||
OnGetNonVisualCompIconCanvas:=@IDECompList.OnGetNonVisualCompIconCanvas;
|
||||
OnModified:=@OnDesignerModified;
|
||||
writeln('[TMainIDE.SetDefaultsforForm] 3');
|
||||
end;
|
||||
end;
|
||||
@ -3348,6 +3350,18 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.OnDesignerModified(Sender: TObject);
|
||||
var i: integer;
|
||||
begin
|
||||
i:=Project.IndexOfUnitWithForm(TDesigner(Sender).Form,false);
|
||||
if i>=0 then begin
|
||||
Project.Units[i].Modified:=true;
|
||||
if Project.Units[i].Loaded then
|
||||
SourceNotebook.FindSourceEditorWithPageIndex(
|
||||
Project.Units[i].EditorIndex).EditorComponent.Modified:=true;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.OnControlSelectionChanged(Sender: TObject);
|
||||
var NewSelectedComponents : TComponentSelectionList;
|
||||
i: integer;
|
||||
@ -3373,6 +3387,9 @@ end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.89 2001/04/04 13:55:34 lazarus
|
||||
MG: finished TComponentPropertyEditor, added OnModified to oi, cfe and designer
|
||||
|
||||
Revision 1.88 2001/04/04 12:20:34 lazarus
|
||||
MG: added add to/remove from project, small bugfixes
|
||||
|
||||
|
@ -229,6 +229,7 @@ type
|
||||
procedure RemoveUnit(Index:integer);
|
||||
function IndexOf(AUnitInfo: TUnitInfo):integer;
|
||||
function IndexOfUnitWithName(AUnitName:string; OnlyProjectUnits:boolean):integer;
|
||||
function IndexOfUnitWithForm(AForm: TComponent; OnlyProjectUnits:boolean):integer;
|
||||
function UnitWithEditorIndex(Index:integer):TUnitInfo;
|
||||
procedure CloseEditorIndex(EditorIndex:integer);
|
||||
procedure InsertEditorIndex(EditorIndex:integer);
|
||||
@ -1148,6 +1149,20 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TProject.IndexOfUnitWithForm(AForm: TComponent;
|
||||
OnlyProjectUnits:boolean):integer;
|
||||
begin
|
||||
Result:=UnitCount-1;
|
||||
while (Result>=0) do begin
|
||||
if (OnlyProjectUnits and Units[Result].IsPartOfProject)
|
||||
or (not OnlyProjectUnits) then begin
|
||||
if Units[Result].Form=AForm then
|
||||
exit;
|
||||
end;
|
||||
dec(Result);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TProject.UnitWithEditorIndex(Index:integer):TUnitInfo;
|
||||
var i:integer;
|
||||
begin
|
||||
@ -1382,6 +1397,9 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.20 2001/04/04 13:55:35 lazarus
|
||||
MG: finished TComponentPropertyEditor, added OnModified to oi, cfe and designer
|
||||
|
||||
Revision 1.19 2001/04/04 12:20:34 lazarus
|
||||
MG: added add to/remove from project, small bugfixes
|
||||
|
||||
|
@ -1,39 +0,0 @@
|
||||
object ViewForms1: TVIEWFORMS1
|
||||
CAPTION = 'View Project Forms'
|
||||
COLOR = -2147483633
|
||||
CLIENTHEIGHT = 200
|
||||
CLIENTWIDTH = 325
|
||||
POSITION = poscreencenter
|
||||
HEIGHT = 200
|
||||
WIDTH = 325
|
||||
object btnOK: TBUTTON
|
||||
CAPTION = 'OK'
|
||||
ONCLICK = BTNOKCLICK
|
||||
LEFT = 235
|
||||
HEIGHT = 25
|
||||
TOP = 10
|
||||
WIDTH = 75
|
||||
end
|
||||
object btnCancel: TBUTTON
|
||||
CAPTION = 'Cancel'
|
||||
ONCLICK = BTNCANCELCLICK
|
||||
LEFT = 235
|
||||
HEIGHT = 25
|
||||
TOP = 45
|
||||
WIDTH = 75
|
||||
end
|
||||
object Edit1: TEDIT
|
||||
TEXT = 'Edit1'
|
||||
LEFT = 10
|
||||
HEIGHT = 25
|
||||
TOP = 10
|
||||
WIDTH = 215
|
||||
end
|
||||
object Listbox1: TLISTBOX
|
||||
ONCLICK = LISTBOX1CLICK
|
||||
LEFT = 10
|
||||
HEIGHT = 145
|
||||
TOP = 45
|
||||
WIDTH = 215
|
||||
end
|
||||
end
|
@ -1,266 +0,0 @@
|
||||
{ $Id$ }
|
||||
{
|
||||
/***************************************************************************
|
||||
ViewForm_dlg.pp
|
||||
-------------------
|
||||
TViewForms is the application dialog for displaying all forms in a project.
|
||||
|
||||
|
||||
Initial Revision : Sat Feb 19 17:42 CST 1999
|
||||
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
}
|
||||
{$H+}
|
||||
unit ViewForm_Dlg;
|
||||
|
||||
{$mode objfpc}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,LResources,buttons,stdctrls;
|
||||
|
||||
|
||||
type
|
||||
|
||||
TViewForms1 = class(TFORM)
|
||||
Edit1: TEdit;
|
||||
ListBox1: TListBox;
|
||||
btnOK : TButton;
|
||||
btnCancel : TButton;
|
||||
Procedure btnOKClick(Sender : TOBject);
|
||||
Procedure btnCancelClick(Sender : TOBject);
|
||||
Procedure listbox1Click(Sender : TObject);
|
||||
protected
|
||||
public
|
||||
// constructor Create(AOwner: TComponent); override;
|
||||
end;
|
||||
|
||||
var
|
||||
ViewForms1 : TViewForms1;
|
||||
|
||||
implementation
|
||||
|
||||
{
|
||||
constructor TViewForms1.Create(AOwner: TComponent);
|
||||
var
|
||||
Pad : Integer;
|
||||
begin
|
||||
|
||||
inherited Create(AOwner);
|
||||
Caption := 'View Project Forms';
|
||||
Left := 0;
|
||||
Top := 0;
|
||||
Width := 325;
|
||||
height := 200;
|
||||
Pad := 10;
|
||||
position := poScreenCenter;
|
||||
Name := 'ViewForms1';
|
||||
|
||||
btnOK := TButton.Create(Self);
|
||||
btnOK.Parent := Self;
|
||||
btnOK.Left := ClientWidth - 90;
|
||||
btnOK.Top := pad;
|
||||
btnOK.Width := 75;
|
||||
btnOK.Height := 25;
|
||||
btnOK.Caption := 'OK';
|
||||
btnOK.Visible := True;
|
||||
btnOK.OnClick := @btnOKClick;
|
||||
btnOK.Name := 'btnOK';
|
||||
|
||||
btnCancel := TButton.Create(Self);
|
||||
btnCancel.Parent := Self;
|
||||
btnCancel.Left := ClientWidth - 90;
|
||||
btnCancel.Top := btnOK.Top + btnOK.Height + pad;
|
||||
btnCancel.Width := 75;
|
||||
btnCancel.Height := 25;
|
||||
btnCancel.Caption := 'Cancel';
|
||||
btnCancel.Visible := True;
|
||||
btnCancel.Name := 'btnCancel';
|
||||
btnCancel.OnClick := @btnCancelClick;
|
||||
|
||||
Edit1 := TEdit.Create(Self);
|
||||
Edit1.Parent := Self;
|
||||
Edit1.Left := pad;
|
||||
Edit1.Top := pad;
|
||||
edit1.Width := ClientWidth - (ClientWidth - btnOK.Left) - (2*pad);
|
||||
Edit1.Height := 25;
|
||||
Edit1.Visible := True;
|
||||
Edit1.Name := 'Edit1';
|
||||
|
||||
|
||||
Listbox1:= TListBox.Create(Self);
|
||||
with Listbox1 do begin
|
||||
Parent:= Self;
|
||||
Top:= Edit1.Height + Edit1.Top + Pad;
|
||||
Left:= pad;
|
||||
Width:= ClientWidth - (ClientWidth - btnOK.Left) - (2*pad);
|
||||
Height:= Self.Height - Top - pad;
|
||||
Visible:= true;
|
||||
MultiSelect:= false;
|
||||
Name := 'Listbox1';
|
||||
OnClick :=@listbox1Click;
|
||||
end;
|
||||
|
||||
end;
|
||||
}
|
||||
|
||||
Procedure TViewForms1.btnOKClick(Sender : TOBject);
|
||||
Begin
|
||||
{
|
||||
Search the list to see if it is already on a page.
|
||||
If so, simply set that page to the front. If not
|
||||
then load it into a new page.
|
||||
}
|
||||
|
||||
//Close the dialog box.
|
||||
ModalResult := mrOK;
|
||||
|
||||
End;
|
||||
|
||||
|
||||
Procedure TViewForms1.btnCancelClick(Sender : TOBject);
|
||||
Begin
|
||||
ModalResult := mrCancel;
|
||||
|
||||
end;
|
||||
|
||||
Procedure TViewForms1.listbox1Click(Sender : TObject);
|
||||
Var
|
||||
I : Integer;
|
||||
Begin
|
||||
if Listbox1.Items.Count > 0 then
|
||||
Begin
|
||||
for i := 0 to Listbox1.Items.Count-1 do
|
||||
Begin
|
||||
if Listbox1.Selected[I] then
|
||||
Begin
|
||||
Edit1.Text := Listbox1.Items.Strings[i];
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
initialization
|
||||
{Do not change the following}
|
||||
{<LAZARUSFORMDEF>}
|
||||
{ $I viewforms1.lrs}
|
||||
{<LAZARUSFORMDEFEND>}
|
||||
{}
|
||||
|
||||
|
||||
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.6 2001/01/16 23:30:45 lazarus
|
||||
trying to determine what's crashing LAzarus on load.
|
||||
Shane
|
||||
|
||||
Revision 1.4 2001/01/14 03:56:57 lazarus
|
||||
Shane
|
||||
|
||||
Revision 1.3 2001/01/13 06:11:07 lazarus
|
||||
Minor fixes
|
||||
Shane
|
||||
|
||||
Revision 1.2 2001/01/05 17:44:37 lazarus
|
||||
ViewUnits1, ViewForms1 and MessageDlg are all loaded from their resources and all controls are auto-created on them.
|
||||
There are still a few problems with some controls so I haven't converted all forms.
|
||||
Shane
|
||||
|
||||
Revision 1.1 2000/07/13 10:27:48 michael
|
||||
+ Initial import
|
||||
|
||||
Revision 1.4 2000/03/19 03:52:08 lazarus
|
||||
Added onclick events for the speedbuttons.
|
||||
Shane
|
||||
|
||||
Revision 1.3 2000/03/03 20:22:02 lazarus
|
||||
Trying to add TBitBtn
|
||||
Shane
|
||||
|
||||
Revision 1.2 2000/02/22 21:29:42 lazarus
|
||||
Added a few more options in the editor like closeing a unit. Also am keeping track of what page , if any, they are currently on.
|
||||
Shane
|
||||
|
||||
Revision 1.1 2000/02/21 17:38:04 lazarus
|
||||
Added modalresult to TCustomForm
|
||||
Added a View Units dialog box
|
||||
Added a View Forms dialog box
|
||||
Added a New Unit menu selection
|
||||
Added a New Form menu selection
|
||||
Shane
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,12 +0,0 @@
|
||||
LazarusResources.Add('TVIEWFORMS1','FORMDATA',
|
||||
'TPF0'#11'TVIEWFORMS1'#10'ViewForms1'#7'CAPTION'#6#18'View Project Forms'#5
|
||||
+'COLOR'#4#15#0#0#128#12'CLIENTHEIGHT'#3#200#0#11'CLIENTWIDTH'#3'E'#1#8'PO'
|
||||
+'SITION'#7#14'poscreencenter'#6'HEIGHT'#3#200#0#5'WIDTH'#3'E'#1#0#7'TBUTT'
|
||||
+'ON'#5'btnOK'#7'CAPTION'#6#2'OK'#7'ONCLICK'#7#10'BTNOKCLICK'#4'LEFT'#3#235
|
||||
+#0#6'HEIGHT'#2#25#3'TOP'#2#10#5'WIDTH'#2'K'#0#0#7'TBUTTON'#9'btnCancel'#7
|
||||
+'CAPTION'#6#6'Cancel'#7'ONCLICK'#7#14'BTNCANCELCLICK'#4'LEFT'#3#235#0#6'H'
|
||||
+'EIGHT'#2#25#3'TOP'#2'-'#5'WIDTH'#2'K'#0#0#5'TEDIT'#5'Edit1'#4'TEXT'#6#5
|
||||
+'Edit1'#4'LEFT'#2#10#6'HEIGHT'#2#25#3'TOP'#2#10#5'WIDTH'#3#215#0#0#0#8'TL'
|
||||
+'ISTBOX'#8'Listbox1'#7'ONCLICK'#7#13'LISTBOX1CLICK'#4'LEFT'#2#10#6'HEIGHT'
|
||||
+#3#145#0#3'TOP'#2'-'#5'WIDTH'#3#215#0#0#0#0
|
||||
);
|
Loading…
Reference in New Issue
Block a user