mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-07 15:56:00 +02:00
fixed win32 intf menu height from Wojciech
git-svn-id: trunk@4827 -
This commit is contained in:
parent
ac30a1f0ee
commit
7b213bc79f
@ -25,7 +25,7 @@ unit DlgForm;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses Classes, Forms, Buttons, Dialogs, Graphics;
|
uses Classes, Forms, Buttons, Dialogs, Graphics, StdCtrls;
|
||||||
|
|
||||||
type
|
type
|
||||||
TSampleDialogs = class(TForm)
|
TSampleDialogs = class(TForm)
|
||||||
@ -37,6 +37,9 @@ type
|
|||||||
saveButton : TButton;
|
saveButton : TButton;
|
||||||
colorButton : TButton;
|
colorButton : TButton;
|
||||||
fontButton : TButton;
|
fontButton : TButton;
|
||||||
|
dirButton : TButton;
|
||||||
|
dirLabel : TLabel;
|
||||||
|
fileLabel : TLabel;
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
procedure buttonClick(Sender : TObject);
|
procedure buttonClick(Sender : TObject);
|
||||||
procedure FormDestroy(Sender : TObject);
|
procedure FormDestroy(Sender : TObject);
|
||||||
@ -51,11 +54,29 @@ constructor TSampleDialogs.Create(AOwner: TComponent);
|
|||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
Caption := 'Common Dialogs';
|
Caption := 'Common Dialogs';
|
||||||
SetBounds(200, 200, 200, 200);
|
SetBounds(200, 200, 400, 230);
|
||||||
Color := clTeal;
|
Color := clTeal;
|
||||||
|
|
||||||
OnDestroy := @FormDestroy;
|
OnDestroy := @FormDestroy;
|
||||||
|
|
||||||
|
dirLabel := TLabel.Create(Self);
|
||||||
|
with dirLabel do
|
||||||
|
begin
|
||||||
|
Parent := Self;
|
||||||
|
SetBounds(110, 40, 280, 35);
|
||||||
|
Caption := 'Directory';
|
||||||
|
Show;
|
||||||
|
end;
|
||||||
|
|
||||||
|
fileLabel := TLabel.Create(Self);
|
||||||
|
with fileLabel do
|
||||||
|
begin
|
||||||
|
Parent := Self;
|
||||||
|
SetBounds(110, 80, 280, 35);
|
||||||
|
Caption := 'File';
|
||||||
|
Show;
|
||||||
|
end;
|
||||||
|
|
||||||
closeButton := TButton.Create(Self);
|
closeButton := TButton.Create(Self);
|
||||||
with closeButton do
|
with closeButton do
|
||||||
begin
|
begin
|
||||||
@ -110,6 +131,17 @@ begin
|
|||||||
Tag := 5;
|
Tag := 5;
|
||||||
Show;
|
Show;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
dirButton := TButton.Create(Self);
|
||||||
|
with dirButton do
|
||||||
|
begin
|
||||||
|
Parent := Self;
|
||||||
|
OnClick := @buttonClick;
|
||||||
|
SetBounds(10, 178, 75, 32);
|
||||||
|
caption := 'Directory';
|
||||||
|
Tag := 6;
|
||||||
|
Show;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSampleDialogs.FormDestroy(Sender : TObject);
|
procedure TSampleDialogs.FormDestroy(Sender : TObject);
|
||||||
@ -125,19 +157,19 @@ begin
|
|||||||
2 : with TOpenDialog.Create(Self) do
|
2 : with TOpenDialog.Create(Self) do
|
||||||
begin
|
begin
|
||||||
Filter := '*.pp';
|
Filter := '*.pp';
|
||||||
Execute;
|
if Execute then fileLabel.Caption := FileName;
|
||||||
Free;
|
Free;
|
||||||
end;
|
end;
|
||||||
3 : with TSaveDialog.Create(Self) do
|
3 : with TSaveDialog.Create(Self) do
|
||||||
begin
|
begin
|
||||||
Filename := 'untitled.pp';
|
Filename := 'untitled.pp';
|
||||||
Execute;
|
if Execute then fileLabel.Caption := FileName;
|
||||||
Free;
|
Free;
|
||||||
end;
|
end;
|
||||||
4 : with TFontDialog.Create(Self) do
|
4 : with TFontDialog.Create(Self) do
|
||||||
begin
|
begin
|
||||||
Font.Assign(Self.Font);
|
Font.Assign(fontButton.Font);
|
||||||
if Execute then Self.Font.Assign(Font);
|
if Execute then fontButton.Font.Assign(Font);
|
||||||
Free;
|
Free;
|
||||||
end;
|
end;
|
||||||
5 : with TColorDialog.Create(Self) do
|
5 : with TColorDialog.Create(Self) do
|
||||||
@ -146,6 +178,11 @@ begin
|
|||||||
if Execute then Self.Color := Color;
|
if Execute then Self.Color := Color;
|
||||||
Free;
|
Free;
|
||||||
end;
|
end;
|
||||||
|
6 : with TSelectDirectoryDialog.Create(Self) do
|
||||||
|
begin
|
||||||
|
if Execute then dirLabel.Caption := FileName;
|
||||||
|
Free;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
@ -1262,6 +1262,8 @@ begin
|
|||||||
Add('program Project1;');
|
Add('program Project1;');
|
||||||
Add('');
|
Add('');
|
||||||
Add('{$mode objfpc}{$H+}');
|
Add('{$mode objfpc}{$H+}');
|
||||||
|
if fProjectType in [ptApplication] then
|
||||||
|
Add('{$AppType Gui} // for win32 applications');
|
||||||
Add('');
|
Add('');
|
||||||
Add('uses');
|
Add('uses');
|
||||||
case fProjectType of
|
case fProjectType of
|
||||||
@ -2736,6 +2738,9 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.140 2003/11/22 23:56:33 mattias
|
||||||
|
fixed win32 intf menu height from Wojciech
|
||||||
|
|
||||||
Revision 1.139 2003/10/15 18:01:10 mattias
|
Revision 1.139 2003/10/15 18:01:10 mattias
|
||||||
implemented extract proc, check lfm and convert delphi unit
|
implemented extract proc, check lfm and convert delphi unit
|
||||||
|
|
||||||
|
@ -29,24 +29,11 @@
|
|||||||
Constructor for the class.
|
Constructor for the class.
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
Constructor TWin32Object.Create;
|
Constructor TWin32Object.Create;
|
||||||
Var
|
|
||||||
R1,R2:TRect;
|
|
||||||
Begin
|
Begin
|
||||||
Inherited Create;
|
Inherited Create;
|
||||||
FAccelGroup := 0;
|
FAccelGroup := 0;
|
||||||
FTimerData := TList.Create;
|
FTimerData := TList.Create;
|
||||||
// Retrieves the height of a win32 menu
|
FWin32MenuHeight:= GetSystemMetrics(SM_CYMENU);
|
||||||
With R1 do
|
|
||||||
begin
|
|
||||||
left:=0;
|
|
||||||
right:=0;
|
|
||||||
right:=100;
|
|
||||||
bottom:=100;
|
|
||||||
end;
|
|
||||||
R2:=R1;
|
|
||||||
Windows.AdjustwindowRect(@R1,WS_OVERLAPPEDWINDOW,true);
|
|
||||||
Windows.AdjustwindowRect(@R2,WS_OVERLAPPEDWINDOW,false);
|
|
||||||
FWin32MenuHeight:= R2.Top - R1.Top;
|
|
||||||
FNextControlId := 0;
|
FNextControlId := 0;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
@ -143,8 +130,8 @@ Begin
|
|||||||
InitCommonControls;
|
InitCommonControls;
|
||||||
|
|
||||||
// Create parent of all windows, `button on taskbar'
|
// Create parent of all windows, `button on taskbar'
|
||||||
FAppHandle := CreateWindow(@ClsName, 'AppTitle', WS_POPUP or WS_CLIPSIBLINGS or
|
FAppHandle := CreateWindow(@ClsName, PChar(Application.Title), WS_POPUP or
|
||||||
WS_CAPTION or WS_SYSMENU or WS_MINIMIZEBOX or WS_VISIBLE,
|
WS_CLIPSIBLINGS or WS_CAPTION or WS_SYSMENU or WS_MINIMIZEBOX or WS_VISIBLE,
|
||||||
0, {Windows.GetSystemMetrics(SM_CXSCREEN) div 2,}
|
0, {Windows.GetSystemMetrics(SM_CXSCREEN) div 2,}
|
||||||
0, {Windows.GetSystemMetrics(SM_CYSCREEN) div 2,}
|
0, {Windows.GetSystemMetrics(SM_CYSCREEN) div 2,}
|
||||||
0, 0, HWND(nil), HMENU(nil), HInstance, nil);
|
0, 0, HWND(nil), HMENU(nil), HInstance, nil);
|
||||||
@ -1463,19 +1450,6 @@ Var
|
|||||||
If fdApplyButton In Options then Result := Result Or CF_APPLY;
|
If fdApplyButton In Options then Result := Result Or CF_APPLY;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
function GetOwnerHandle: HWND;
|
|
||||||
begin
|
|
||||||
with Sender do
|
|
||||||
begin
|
|
||||||
if Owner Is TWinControl then
|
|
||||||
Result := TWinControl(Owner).Handle
|
|
||||||
else if Owner Is TApplication then
|
|
||||||
Result := TApplication(Owner).Handle
|
|
||||||
else
|
|
||||||
Result := FAppHandle;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure ReplacePipe(var AFilter:string);
|
procedure ReplacePipe(var AFilter:string);
|
||||||
var i:integer;
|
var i:integer;
|
||||||
begin
|
begin
|
||||||
@ -1534,7 +1508,7 @@ Begin
|
|||||||
With CC Do
|
With CC Do
|
||||||
Begin
|
Begin
|
||||||
LStructSize := SizeOf(TChooseColor);
|
LStructSize := SizeOf(TChooseColor);
|
||||||
HWndOwner := GetOwnerHandle;
|
HWndOwner := GetOwnerHandle(Sender);
|
||||||
RGBResult := TColorDialog(Sender).Color;
|
RGBResult := TColorDialog(Sender).Color;
|
||||||
LPCustColors := @CustomColors;
|
LPCustColors := @CustomColors;
|
||||||
Flags := CC_FullOpen Or CC_RGBInit;
|
Flags := CC_FullOpen Or CC_RGBInit;
|
||||||
@ -1561,7 +1535,7 @@ Begin
|
|||||||
With OpenFile Do
|
With OpenFile Do
|
||||||
Begin
|
Begin
|
||||||
LStructSize := SizeOf(OpenFileName);
|
LStructSize := SizeOf(OpenFileName);
|
||||||
HWndOwner := GetOwnerHandle;
|
HWndOwner := GetOwnerHandle(Sender);
|
||||||
LPStrFilter := PChar(FFilter);
|
LPStrFilter := PChar(FFilter);
|
||||||
LPStrFile := FName;
|
LPStrFile := FName;
|
||||||
LPStrTitle := PChar(Title);
|
LPStrTitle := PChar(Title);
|
||||||
@ -1605,7 +1579,7 @@ Begin
|
|||||||
With CF Do
|
With CF Do
|
||||||
Begin
|
Begin
|
||||||
LStructSize := SizeOf(TChooseFont);
|
LStructSize := SizeOf(TChooseFont);
|
||||||
HWndOwner := GetOwnerHandle;
|
HWndOwner := GetOwnerHandle(Sender);
|
||||||
LPLogFont := @LF;
|
LPLogFont := @LF;
|
||||||
Flags := GetFlagsFromOptions(Options);
|
Flags := GetFlagsFromOptions(Options);
|
||||||
Flags := Flags Or CF_INITTOLOGFONTSTRUCT Or CF_BOTH;
|
Flags := Flags Or CF_INITTOLOGFONTSTRUCT Or CF_BOTH;
|
||||||
@ -1647,7 +1621,7 @@ Begin
|
|||||||
|
|
||||||
With bi do
|
With bi do
|
||||||
Begin
|
Begin
|
||||||
hwndOwner := 0; // should be owner handle
|
hwndOwner := GetOwnerHandle(Sender);
|
||||||
pidlRoot := nil;
|
pidlRoot := nil;
|
||||||
pszDisplayName := Buffer;
|
pszDisplayName := Buffer;
|
||||||
lpszTitle := PChar(Sender.Title);
|
lpszTitle := PChar(Sender.Title);
|
||||||
@ -2896,6 +2870,9 @@ End;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.133 2003/11/22 23:56:33 mattias
|
||||||
|
fixed win32 intf menu height from Wojciech
|
||||||
|
|
||||||
Revision 1.132 2003/11/21 20:32:01 micha
|
Revision 1.132 2003/11/21 20:32:01 micha
|
||||||
cleanups; wm_hscroll/wm_vscroll fix
|
cleanups; wm_hscroll/wm_vscroll fix
|
||||||
|
|
||||||
|
@ -508,6 +508,18 @@ Begin
|
|||||||
Assert (False, 'Trace:[ObjectToHWND]****** Warning: handle = 0 *******');
|
Assert (False, 'Trace:[ObjectToHWND]****** Warning: handle = 0 *******');
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
function GetOwnerHandle(ADialog : TCommonDialog): HWND;
|
||||||
|
begin
|
||||||
|
with ADialog do
|
||||||
|
begin
|
||||||
|
if Owner Is TWinControl then
|
||||||
|
Result := TWinControl(Owner).Handle
|
||||||
|
else if Owner Is TApplication then
|
||||||
|
Result := TApplication(Owner).Handle
|
||||||
|
else
|
||||||
|
Result := TWin32Object(InterfaceObject).FAppHandle;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
(***********************************************************************
|
(***********************************************************************
|
||||||
Widget member Functions
|
Widget member Functions
|
||||||
@ -704,6 +716,9 @@ End;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.30 2003/11/22 23:56:33 mattias
|
||||||
|
fixed win32 intf menu height from Wojciech
|
||||||
|
|
||||||
Revision 1.29 2003/11/18 07:20:40 micha
|
Revision 1.29 2003/11/18 07:20:40 micha
|
||||||
added "included by" notice at top of file
|
added "included by" notice at top of file
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user