Skip to content

Commit

Permalink
Update FormDesigner icons and add Delete to menu
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnPeel committed Jul 12, 2016
1 parent 784804e commit 35e6584
Show file tree
Hide file tree
Showing 4 changed files with 755 additions and 308 deletions.
4 changes: 4 additions & 0 deletions Projects/FormDesigner/design_frm.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ object DsgnForm: TDsgnForm
Caption = 'Edit list items'
Visible = False
end
object MenuItemDelete: TMenuItem
Caption = 'Delete'
OnClick = MenuItemDeleteClick
end
end
object FontDialog1: TFontDialog
MinFontSize = 0
Expand Down
20 changes: 14 additions & 6 deletions Projects/FormDesigner/design_frm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ TDsgnForm = class(TForm)
MenuItem2: TMenuItem;
MenuItem3: TMenuItem;
MenuItem4: TMenuItem;
MenuItemDelete: TMenuItem;
PopupMenu1: TPopupMenu;
sor: TSelectOnRunTime;
procedure FormChangeBounds(Sender: TObject);
Expand All @@ -31,6 +32,7 @@ TDsgnForm = class(TForm)
procedure FormResize(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure MenuItem1Click(Sender: TObject);
procedure MenuItemDeleteClick(Sender: TObject);
procedure sorBeforeSelect(Sender: TObject; Selected: TControl;
var Select: Boolean);
procedure OnResizeCtrl(Sender: TObject);
Expand Down Expand Up @@ -188,6 +190,11 @@ procedure TDsgnForm.MenuItem1Click(Sender: TObject);

end;

procedure TDsgnForm.MenuItemDeleteClick(Sender: TObject);
begin
DeleteComponent;
end;

procedure TDsgnForm.sorBeforeSelect(Sender: TObject; Selected: TControl;
var Select: Boolean);
var
Expand Down Expand Up @@ -398,12 +405,13 @@ procedure TDsgnForm.CreateWnd;

procedure TDsgnForm.DeleteComponent();
begin
if not assigned(CurComp) then exit else
begin
sor.Selected := False;
sor.SelectControl := nil;
FreeAndNil(CurComp);
end;
if Assigned(CurComp) then
begin
sor.Selected := False;
sor.SelectControl := nil;
FreeAndNil(CurComp);
end else
WriteLn('You do not have a component selected.');
end;

procedure TDsgnForm.SetMode(i: integer);
Expand Down
Loading

0 comments on commit 35e6584

Please sign in to comment.