mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-09 21:59:23 +02:00
lcl, win32: fix form.icon handling (#0012395)
git-svn-id: trunk@17077 -
This commit is contained in:
parent
28c3c5b1d3
commit
9dc2198062
@ -1265,7 +1265,7 @@ begin
|
||||
if HandleAllocated then
|
||||
begin
|
||||
TWSCustomFormClass(WidgetSetClass).SetFormBorderStyle(Self, NewStyle);
|
||||
TWSCustomFormClass(WidgetSetClass).SetIcon(Self, 0, 0);
|
||||
Perform(CM_ICONCHANGED, 0, 0);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -260,7 +260,7 @@ begin
|
||||
NumButtons := ButtonCount;
|
||||
Buttons := TheButtons;
|
||||
|
||||
If (DefaultIndex >= ButtonCount) or
|
||||
if (DefaultIndex >= ButtonCount) or
|
||||
(DefaultIndex < 0)
|
||||
then
|
||||
TheDefaultIndex := 0
|
||||
@ -268,12 +268,12 @@ begin
|
||||
theDefaultIndex := DefaultIndex;
|
||||
|
||||
// Assures a minimum text size
|
||||
If MSG = '' then MSG := ' ';
|
||||
if MSG = '' then MSG := ' ';
|
||||
|
||||
// Initialize TextStyle
|
||||
FillChar(TextStyle, SizeOf(TTextStyle), 0);
|
||||
|
||||
With TextStyle do
|
||||
with TextStyle do
|
||||
begin
|
||||
Clipping := True;
|
||||
Wordbreak := True;
|
||||
@ -534,7 +534,7 @@ begin
|
||||
Top := Y;
|
||||
end;
|
||||
theModalResult := ShowModal;
|
||||
Case theModalResult of
|
||||
case theModalResult of
|
||||
-1 : Result := EscapeResult
|
||||
else
|
||||
Result := DialogResult[theModalResult];
|
||||
|
@ -98,6 +98,7 @@ var
|
||||
SysMenu: HMENU;
|
||||
Handle: HWND;
|
||||
DC: HDC;
|
||||
AIcon: HICON;
|
||||
begin
|
||||
Assert(False, 'Trace:Win32Object.Init - Start');
|
||||
if not WinRegister then
|
||||
@ -147,8 +148,8 @@ begin
|
||||
AllocWindowInfo(FAppHandle);
|
||||
|
||||
// set nice main icon
|
||||
Windows.SendMessage(FAppHandle, WM_SETICON, ICON_BIG,
|
||||
LParam(Windows.LoadIcon(MainInstance, 'MAINICON')));
|
||||
AIcon := Windows.LoadIcon(MainInstance, 'MAINICON');
|
||||
AppSetIcon(AIcon, AIcon);
|
||||
// remove useless menuitems from sysmenu
|
||||
SysMenu := Windows.GetSystemMenu(FAppHandle, False);
|
||||
Windows.DeleteMenu(SysMenu, SC_MAXIMIZE, MF_BYCOMMAND);
|
||||
@ -414,7 +415,10 @@ end;
|
||||
procedure TWin32WidgetSet.AppSetIcon(const Small, Big: HICON);
|
||||
begin
|
||||
Windows.SendMessage(Win32Widgetset.AppHandle, WM_SETICON, ICON_SMALL, LPARAM(Small));
|
||||
SetClassLong(Win32Widgetset.AppHandle, GCL_HICONSM, LONG(Small));
|
||||
|
||||
Windows.SendMessage(Win32Widgetset.AppHandle, WM_SETICON, ICON_BIG, LPARAM(Big));
|
||||
SetClassLong(Win32Widgetset.AppHandle, GCL_HICON, LONG(Big));
|
||||
end;
|
||||
|
||||
procedure TWin32WidgetSet.AppSetTitle(const ATitle: string);
|
||||
@ -639,19 +643,6 @@ begin
|
||||
if Flags = SW_SHOWMAXIMIZED then
|
||||
Windows.SendMessage(Handle, WM_SHOWWINDOW, 1, 0);
|
||||
end;
|
||||
if (Sender is TCustomForm) then
|
||||
begin
|
||||
if TCustomForm(Sender).BorderStyle <> bsDialog then
|
||||
begin
|
||||
SetClassLong(Handle, GCL_HICONSM, LONG(TCustomForm(Sender).SmallIconHandle));
|
||||
SetClassLong(Handle, GCL_HICON, LONG(TCustomForm(Sender).BigIconHandle));
|
||||
end
|
||||
else
|
||||
begin
|
||||
SetClassLong(Handle, GCL_HICONSM, 0);
|
||||
SetClassLong(Handle, GCL_HICON, 0);
|
||||
end;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
|
@ -414,11 +414,17 @@ begin
|
||||
end;
|
||||
|
||||
class procedure TWin32WSCustomForm.SetIcon(const AForm: TCustomForm; const Small, Big: HICON);
|
||||
var
|
||||
Wnd: HWND;
|
||||
begin
|
||||
if not WSCheckHandleAllocated(AForm, 'SetIcon') then
|
||||
Exit;
|
||||
SendMessage(AForm.Handle, WM_SETICON, ICON_SMALL, LPARAM(Small));
|
||||
SendMessage(AForm.Handle, WM_SETICON, ICON_BIG, LPARAM(Big));
|
||||
Wnd := AForm.Handle;
|
||||
SendMessage(Wnd, WM_SETICON, ICON_SMALL, LPARAM(Small));
|
||||
SetClassLong(Wnd, GCL_HICONSM, LONG(Small));
|
||||
|
||||
SendMessage(Wnd, WM_SETICON, ICON_BIG, LPARAM(Big));
|
||||
SetClassLong(Wnd, GCL_HICON, LONG(Big));
|
||||
end;
|
||||
|
||||
class procedure TWin32WSCustomForm.SetShowInTaskbar(const AForm: TCustomForm;
|
||||
|
Loading…
Reference in New Issue
Block a user