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
CAPTION = 'View Project Units'
CLIENTHEIGHT = 200
CLIENTWIDTH = 325
POSITION = poscreencenter
HORZSCROLLBAR.PAGE = 326
VERTSCROLLBAR.PAGE = 201
LEFT = 477
HEIGHT = 200
TOP = 412
WIDTH = 325
object btnOK: TBUTTON
ANCHORS = [aktop, akleft]
CAPTION = 'OK'
ONCLICK = BTNOKCLICK
LEFT = 235
HEIGHT = 25
TOP = 10
WIDTH = 75
object VIEWUNITS: TVIEWUNITS
Caption = 'View Project Units'
ClientHeight = 204
ClientWidth = 416
Position = poScreenCenter
HorzScrollBar.Page = 417
VertScrollBar.Page = 205
Left = 477
Height = 204
Top = 412
Width = 416
object btnOK: TButton
Anchors = [akTop, akRight]
Caption = 'OK'
TabOrder = 0
OnClick = BTNOKCLICK
Cursor = 25
Left = 312
Height = 25
Top = 10
Width = 96
end
object btnCancel: TBUTTON
ANCHORS = [aktop, akleft]
CAPTION = 'Cancel'
TABORDER = 1
ONCLICK = BTNCANCELCLICK
LEFT = 235
HEIGHT = 25
TOP = 45
WIDTH = 75
object btnCancel: TButton
Anchors = [akTop, akRight]
Caption = 'Cancel'
TabOrder = 1
OnClick = BTNCANCELCLICK
Cursor = 25
Left = 312
Height = 25
Top = 45
Width = 96
end
object Edit1: TEDIT
ANCHORS = [aktop, akleft]
TEXT = 'Edit1'
TABORDER = 2
LEFT = 10
HEIGHT = 25
TOP = 10
WIDTH = 215
object Edit: TEdit
Anchors = [akTop, akLeft, akRight]
Enabled = False
TabOrder = 2
TabOrder = 2
Left = 10
Height = 25
Top = 10
Width = 294
end
object Listbox1: TLISTBOX
ANCHORS = [aktop, akleft]
ONCLICK = LISTBOX1CLICK
TABORDER = 3
TOPINDEX = -1
LEFT = 10
HEIGHT = 145
TOP = 45
WIDTH = 215
object Listbox: TListBox
Anchors = [akTop, akLeft, akRight, akBottom]
TabOrder = 3
TopIndex = -1
Left = 10
Height = 147
Top = 45
Width = 294
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

View File

@ -50,37 +50,38 @@ type
end;
TViewUnits = class(TForm)
Edit: TEdit;
ListBox: TListBox;
btnOK : TButton;
btnCancel : TButton;
MultiselectCheckBox: TCheckBox;
procedure ViewUnitsResize(Sender: TObject);
btnOK: TButton;
btnCancel: TButton;
MultiSelectCheckBox: TCheckBox;
Procedure btnOKClick(Sender :TObject);
Procedure btnCancelClick(Sender :TObject);
procedure MultiselectCheckBoxClick(Sender :TObject);
public
constructor Create(AOwner: TComponent); override;
constructor Create(TheOwner: TComponent); override;
end;
function ShowViewUnitsDlg(Entries: TList; MultiSelect: boolean;
Caption: string): TModalResult;
// Entries is a list of TViewUnitsEntry(s)
const Caption: string): TModalResult;
// Entries is a list of TViewUnitsEntry(s)
implementation
function ShowViewUnitsDlg(Entries: TList;
MultiSelect: boolean; Caption: string): TModalResult;
MultiSelect: boolean; const Caption: string): TModalResult;
var ViewUnits: TViewUnits;
i: integer;
begin
ViewUnits:=TViewUnits.Create(Application);
try
ViewUnits.Caption:=Caption;
ViewUnits.ListBox.Visible:=false;
ViewUnits.MultiselectCheckBox.Enabled:=MultiSelect;
ViewUnits.MultiselectCheckBox.Checked:=MultiSelect;
ViewUnits.ListBox.Multiselect:=ViewUnits.MultiselectCheckBox.Checked;
with ViewUnits.ListBox.Items do begin
BeginUpdate;
Clear;
@ -90,7 +91,6 @@ begin
end;
for i:=0 to Entries.Count-1 do
ViewUnits.ListBox.Selected[i]:=TViewUnitsEntry(Entries[i]).Selected;
ViewUnits.ListBox.Visible:=true;
Result:=ViewUnits.ShowModal;
if Result=mrOk then begin
for i:=0 to Entries.Count-1 do begin
@ -115,112 +115,16 @@ end;
{ TViewUnits }
constructor TViewUnits.Create(AOwner: TComponent);
var
Pad : Integer;
constructor TViewUnits.Create(TheOwner: TComponent);
begin
inherited Create(AOwner);
if LazarusResources.Find(Classname)=nil then begin
Caption := lisViewProjectUnits;
Width:=325;
Height:=200;
Position:=poScreenCenter;
Pad := 10;
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;
inherited Create(TheOwner);
IDEDialogLayoutList.ApplyLayout(Self,450,300);
btnOK.Caption:='Ok';
btnOk.Left:=ClientWidth-btnOk.Width-5;
btnCancel.Caption:='Cancel';
btnCancel.Left:=btnOk.Left;
MultiSelectCheckBox.Caption:='Multi Select';
MultiSelectCheckBox.Left:=btnOk.Left;
end;
Procedure TViewUnits.btnOKClick(Sender : TOBject);
@ -229,7 +133,6 @@ Begin
ModalResult := mrOK;
End;
Procedure TViewUnits.btnCancelClick(Sender : TOBject);
Begin
IDEDialogLayoutList.SaveLayout(Self);
@ -243,12 +146,15 @@ end;
initialization
{ $I viewunits1.lrs}
{$I viewunits1.lrs}
end.
{
$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
localization, added context policy to make resource string dialog

View File

@ -1,12 +1,22 @@
LazarusResources.Add('TVIEWUNITS1','FORMDATA',
'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
+'poscreencenter'#6'HEIGHT'#3#200#0#5'WIDTH'#3'E'#1#0#7'TBUTTON'#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'HEIGHT'#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'TLISTBOX'#8'Listb'
+'ox1'#11'BORDERSTYLE'#7#2'TL'#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
);
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TVIEWUNITS','FORMDATA',[
'TPF0'#10'TVIEWUNITS'#9'VIEWUNITS'#7'Caption'#6#18'View Project Units'#12'Cli'
+'entHeight'#3#204#0#11'ClientWidth'#3#160#1#8'Position'#7#14'poScreenCenter'
+#18'HorzScrollBar.Page'#3#161#1#18'VertScrollBar.Page'#3#205#0#4'Left'#3#221
+#1#6'Height'#3#204#0#3'Top'#3#156#1#5'Width'#3#160#1#0#7'TButton'#5'btnOK'#7
+'Anchors'#11#5'akTop'#7'akRight'#0#7'Caption'#6#2'OK'#8'TabOrder'#2#0#7'OnCl'
+'ick'#7#10'BTNOKCLICK'#6'Cursor'#2#25#4'Left'#3'8'#1#6'Height'#2#25#3'Top'#2
+#10#5'Width'#2'`'#0#0#7'TButton'#9'btnCancel'#7'Anchors'#11#5'akTop'#7'akRig'
+'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
]);