fixed view unit dialog using lfm

git-svn-id: trunk@5366 -
This commit is contained in:
mattias 2004-04-03 13:35:14 +00:00
parent 0b7e7ec113
commit 8ea8150466
3 changed files with 105 additions and 174 deletions

View File

@ -1,50 +1,65 @@
object VIEWUNITS1: TVIEWUNITS1 object VIEWUNITS: TVIEWUNITS
CAPTION = 'View Project Units' Caption = 'View Project Units'
CLIENTHEIGHT = 200 ClientHeight = 204
CLIENTWIDTH = 325 ClientWidth = 416
POSITION = poscreencenter Position = poScreenCenter
HORZSCROLLBAR.PAGE = 326 HorzScrollBar.Page = 417
VERTSCROLLBAR.PAGE = 201 VertScrollBar.Page = 205
LEFT = 477 Left = 477
HEIGHT = 200 Height = 204
TOP = 412 Top = 412
WIDTH = 325 Width = 416
object btnOK: TBUTTON object btnOK: TButton
ANCHORS = [aktop, akleft] Anchors = [akTop, akRight]
CAPTION = 'OK' Caption = 'OK'
ONCLICK = BTNOKCLICK TabOrder = 0
LEFT = 235 OnClick = BTNOKCLICK
HEIGHT = 25 Cursor = 25
TOP = 10 Left = 312
WIDTH = 75 Height = 25
Top = 10
Width = 96
end end
object btnCancel: TBUTTON object btnCancel: TButton
ANCHORS = [aktop, akleft] Anchors = [akTop, akRight]
CAPTION = 'Cancel' Caption = 'Cancel'
TABORDER = 1 TabOrder = 1
ONCLICK = BTNCANCELCLICK OnClick = BTNCANCELCLICK
LEFT = 235 Cursor = 25
HEIGHT = 25 Left = 312
TOP = 45 Height = 25
WIDTH = 75 Top = 45
Width = 96
end end
object Edit1: TEDIT object Edit: TEdit
ANCHORS = [aktop, akleft] Anchors = [akTop, akLeft, akRight]
TEXT = 'Edit1' Enabled = False
TABORDER = 2 TabOrder = 2
LEFT = 10 TabOrder = 2
HEIGHT = 25 Left = 10
TOP = 10 Height = 25
WIDTH = 215 Top = 10
Width = 294
end end
object Listbox1: TLISTBOX object Listbox: TListBox
ANCHORS = [aktop, akleft] Anchors = [akTop, akLeft, akRight, akBottom]
ONCLICK = LISTBOX1CLICK TabOrder = 3
TABORDER = 3 TopIndex = -1
TOPINDEX = -1 Left = 10
LEFT = 10 Height = 147
HEIGHT = 145 Top = 45
TOP = 45 Width = 294
WIDTH = 215 end
object MultiSelectCheckBox: TCheckBox
AllowGrayed = True
Anchors = [akTop, akRight]
Caption = 'Multi Select'
DragCursor = 65524
OnClick = MultiselectCheckBoxClick
TabOrder = 4
Left = 310
Height = 20
Top = 92
Width = 98
end end
end end

View File

@ -50,37 +50,38 @@ type
end; end;
TViewUnits = class(TForm) TViewUnits = class(TForm)
Edit: TEdit;
ListBox: TListBox; ListBox: TListBox;
btnOK : TButton; btnOK: TButton;
btnCancel : TButton; btnCancel: TButton;
MultiselectCheckBox: TCheckBox; MultiSelectCheckBox: TCheckBox;
procedure ViewUnitsResize(Sender: TObject);
Procedure btnOKClick(Sender :TObject); Procedure btnOKClick(Sender :TObject);
Procedure btnCancelClick(Sender :TObject); Procedure btnCancelClick(Sender :TObject);
procedure MultiselectCheckBoxClick(Sender :TObject); procedure MultiselectCheckBoxClick(Sender :TObject);
public public
constructor Create(AOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
end; end;
function ShowViewUnitsDlg(Entries: TList; MultiSelect: boolean; function ShowViewUnitsDlg(Entries: TList; MultiSelect: boolean;
Caption: string): TModalResult; const Caption: string): TModalResult;
// Entries is a list of TViewUnitsEntry(s) // Entries is a list of TViewUnitsEntry(s)
implementation implementation
function ShowViewUnitsDlg(Entries: TList; function ShowViewUnitsDlg(Entries: TList;
MultiSelect: boolean; Caption: string): TModalResult; MultiSelect: boolean; const Caption: string): TModalResult;
var ViewUnits: TViewUnits; var ViewUnits: TViewUnits;
i: integer; i: integer;
begin begin
ViewUnits:=TViewUnits.Create(Application); ViewUnits:=TViewUnits.Create(Application);
try try
ViewUnits.Caption:=Caption; ViewUnits.Caption:=Caption;
ViewUnits.ListBox.Visible:=false;
ViewUnits.MultiselectCheckBox.Enabled:=MultiSelect; ViewUnits.MultiselectCheckBox.Enabled:=MultiSelect;
ViewUnits.MultiselectCheckBox.Checked:=MultiSelect;
ViewUnits.ListBox.Multiselect:=ViewUnits.MultiselectCheckBox.Checked;
with ViewUnits.ListBox.Items do begin with ViewUnits.ListBox.Items do begin
BeginUpdate; BeginUpdate;
Clear; Clear;
@ -90,7 +91,6 @@ begin
end; end;
for i:=0 to Entries.Count-1 do for i:=0 to Entries.Count-1 do
ViewUnits.ListBox.Selected[i]:=TViewUnitsEntry(Entries[i]).Selected; ViewUnits.ListBox.Selected[i]:=TViewUnitsEntry(Entries[i]).Selected;
ViewUnits.ListBox.Visible:=true;
Result:=ViewUnits.ShowModal; Result:=ViewUnits.ShowModal;
if Result=mrOk then begin if Result=mrOk then begin
for i:=0 to Entries.Count-1 do begin for i:=0 to Entries.Count-1 do begin
@ -115,112 +115,16 @@ end;
{ TViewUnits } { TViewUnits }
constructor TViewUnits.Create(AOwner: TComponent); constructor TViewUnits.Create(TheOwner: TComponent);
var
Pad : Integer;
begin begin
inherited Create(AOwner); inherited Create(TheOwner);
IDEDialogLayoutList.ApplyLayout(Self,450,300);
if LazarusResources.Find(Classname)=nil then begin btnOK.Caption:='Ok';
Caption := lisViewProjectUnits; btnOk.Left:=ClientWidth-btnOk.Width-5;
Width:=325; btnCancel.Caption:='Cancel';
Height:=200; btnCancel.Left:=btnOk.Left;
Position:=poScreenCenter; MultiSelectCheckBox.Caption:='Multi Select';
Pad := 10; MultiSelectCheckBox.Left:=btnOk.Left;
OnResize:=@ViewUnitsResize;
btnOK := TButton.Create(Self);
with btnOk do begin
Parent := Self;
Left := Self.Width - 90;
Top := pad;
Width := 75;
Height := 25;
Caption := 'OK';
Visible := True;
OnClick := @btnOKClick;
Name := 'btnOK';
end;
btnCancel := TButton.Create(Self);
with btnCancel do begin
Parent := Self;
Left := Self.Width - 90;
Top := btnOK.Top + btnOK.Height + pad;
Width := 75;
Height := 25;
Caption := dlgCancel;
Visible := True;
Name := 'btnCancel';
OnClick := @btnCancelClick;
end;
Listbox:= TListBox.Create(Self);
with Listbox do
begin
Parent:= Self;
Top:= Pad;
Left:= Pad;
Width:= Self.Width - (Self.Width - btnOK.Left) - (2*pad);
Height:= Self.Height - Top - Pad;
MultiSelect:= false;
Name := 'Listbox';
Visible:= true;
OnDblClick:=@btnOKClick;
end;
MultiselectCheckBox:=TCheckBox.Create(Self);
with MultiselectCheckBox do begin
Parent:=Self;
Name:='MultiselectCheckBox';
Left:=btnOK.Left;
Top:=btnCancel.Top+btnCancel.Height+2*pad;
Width:=btnOk.Width;
Height:=25;
Caption:=dlgMulti;
Checked:=false;
OnClick:=@MultiselectCheckBoxClick;
Visible:=true;
end;
end;
IDEDialogLayoutList.ApplyLayout(Self,325,300);
ViewUnitsResize(nil);
end;
procedure TViewUnits.ViewUnitsResize(Sender: TObject);
var Pad: integer;
begin
Pad:=10;
with btnOk do begin
Left := Self.Width - 90;
Top := pad;
Width := 75;
Height := 25;
end;
with btnCancel do begin
Left := Self.Width - 90;
Top := btnOK.Top + btnOK.Height + pad;
Width := 75;
Height := 25;
end;
with Listbox do begin
Top:= Pad;
Left:= Pad;
Width:= Self.Width - (Self.Width - btnOK.Left) - (2*pad);
Height:= Self.Height - Top - Pad;
end;
with MultiselectCheckBox do begin
Left:=btnOK.Left;
Top:=btnCancel.Top+btnCancel.Height+2*pad;
Width:=btnOk.Width;
Height:=25;
end;
end; end;
Procedure TViewUnits.btnOKClick(Sender : TOBject); Procedure TViewUnits.btnOKClick(Sender : TOBject);
@ -229,7 +133,6 @@ Begin
ModalResult := mrOK; ModalResult := mrOK;
End; End;
Procedure TViewUnits.btnCancelClick(Sender : TOBject); Procedure TViewUnits.btnCancelClick(Sender : TOBject);
Begin Begin
IDEDialogLayoutList.SaveLayout(Self); IDEDialogLayoutList.SaveLayout(Self);
@ -243,12 +146,15 @@ end;
initialization initialization
{ $I viewunits1.lrs} {$I viewunits1.lrs}
end. end.
{ {
$Log$ $Log$
Revision 1.17 2004/04/03 13:35:14 mattias
fixed view unit dialog using lfm
Revision 1.16 2003/05/02 22:22:15 mattias Revision 1.16 2003/05/02 22:22:15 mattias
localization, added context policy to make resource string dialog localization, added context policy to make resource string dialog

View File

@ -1,12 +1,22 @@
LazarusResources.Add('TVIEWUNITS1','FORMDATA', { This is an automatically generated lazarus resource file }
'TPF0'#11'TVIEWUNITS1'#0#7'CAPTION'#6#18'View Project Units'#5'COLOR'#4#15
+#0#0#128#12'CLIENTHEIGHT'#3#200#0#11'CLIENTWIDTH'#3'E'#1#8'POSITION'#7#14 LazarusResources.Add('TVIEWUNITS','FORMDATA',[
+'poscreencenter'#6'HEIGHT'#3#200#0#5'WIDTH'#3'E'#1#0#7'TBUTTON'#5'btnOK'#7 'TPF0'#10'TVIEWUNITS'#9'VIEWUNITS'#7'Caption'#6#18'View Project Units'#12'Cli'
+'CAPTION'#6#2'OK'#7'ONCLICK'#7#10'BTNOKCLICK'#4'LEFT'#3#235#0#6'HEIGHT'#2 +'entHeight'#3#204#0#11'ClientWidth'#3#160#1#8'Position'#7#14'poScreenCenter'
+#25#3'TOP'#2#10#5'WIDTH'#2'K'#0#0#7'TBUTTON'#9'btnCancel'#7'CAPTION'#6#6 +#18'HorzScrollBar.Page'#3#161#1#18'VertScrollBar.Page'#3#205#0#4'Left'#3#221
+'Cancel'#7'ONCLICK'#7#14'BTNCANCELCLICK'#4'LEFT'#3#235#0#6'HEIGHT'#2#25#3 +#1#6'Height'#3#204#0#3'Top'#3#156#1#5'Width'#3#160#1#0#7'TButton'#5'btnOK'#7
+'TOP'#2'-'#5'WIDTH'#2'K'#0#0#5'TEDIT'#5'Edit1'#4'TEXT'#6#5'Edit1'#4'LEFT' +'Anchors'#11#5'akTop'#7'akRight'#0#7'Caption'#6#2'OK'#8'TabOrder'#2#0#7'OnCl'
+#2#10#6'HEIGHT'#2#25#3'TOP'#2#10#5'WIDTH'#3#215#0#0#0#8'TLISTBOX'#8'Listb' +'ick'#7#10'BTNOKCLICK'#6'Cursor'#2#25#4'Left'#3'8'#1#6'Height'#2#25#3'Top'#2
+'ox1'#11'BORDERSTYLE'#7#2'TL'#7'ONCLICK'#7#13'LISTBOX1CLICK'#4'LEFT'#2#10 +#10#5'Width'#2'`'#0#0#7'TButton'#9'btnCancel'#7'Anchors'#11#5'akTop'#7'akRig'
+#6'HEIGHT'#3#145#0#3'TOP'#2'-'#5'WIDTH'#3#215#0#0#0#0 +'ht'#0#7'Caption'#6#6'Cancel'#8'TabOrder'#2#1#7'OnClick'#7#14'BTNCANCELCLICK'
); +#6'Cursor'#2#25#4'Left'#3'8'#1#6'Height'#2#25#3'Top'#2'-'#5'Width'#2'`'#0#0#5
+'TEdit'#4'Edit'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#7'Enabled'#8#8
+'TabOrder'#2#2#8'TabOrder'#2#2#4'Left'#2#10#6'Height'#2#25#3'Top'#2#10#5'Wid'
+'th'#3'&'#1#0#0#8'TListBox'#7'Listbox'#7'Anchors'#11#5'akTop'#6'akLeft'#7'ak'
+'Right'#8'akBottom'#0#8'TabOrder'#2#3#8'TopIndex'#2#255#4'Left'#2#10#6'Heigh'
+'t'#3#147#0#3'Top'#2'-'#5'Width'#3'&'#1#0#0#9'TCheckBox'#19'MultiSelectCheck'
+'Box'#11'AllowGrayed'#9#7'Anchors'#11#5'akTop'#7'akRight'#0#7'Caption'#6#12
+'Multi Select'#10'DragCursor'#4#244#255#0#0#7'OnClick'#7#24'MultiselectCheck'
+'BoxClick'#8'TabOrder'#2#4#4'Left'#3'6'#1#6'Height'#2#20#3'Top'#2'\'#5'Width'
+#2'b'#0#0#0
]);