win32: move few spinedit handlers from generic windowproc to spinedit windowproc

git-svn-id: trunk@23616 -
This commit is contained in:
paul 2010-02-03 10:34:48 +00:00
parent bf426e5704
commit 83ea351c48
2 changed files with 25 additions and 29 deletions

View File

@ -605,22 +605,6 @@ var
end;
end;
procedure DestroyFloatSpinEditBuddy(SpinEditHandle: HWND);
var
Buddy: HWND;
begin
Buddy := SendMessage(SpinEditHandle, UDM_GETBUDDY, 0, 0);
DestroyWindow(Buddy);
end;
procedure EnableFloatSpinEditBuddy(SpinEditHandle: HWND; Enable: boolean);
var
Buddy: HWND;
begin
Buddy := SendMessage(SpinEditHandle, UDM_GETBUDDY, 0, 0);
Windows.EnableWindow(Buddy, Enable);
end;
procedure EnableChildWindows(WinControl: TWinControl; Enable: boolean);
var
i: integer;
@ -1579,8 +1563,6 @@ begin
Assert(False, 'Trace:WindowProc - Got WM_DESTROY');
if lWinControl is TCheckListBox then
TWin32CheckListBoxStrings.DeleteItemRecords(Window);
if lWinControl is TCustomFloatSpinEdit then
DestroyFloatSpinEditBuddy(Window);
if lWinControl is TCustomComboBox then
DisposeComboEditWindowInfo(TCustomComboBox(lWinControl));
if WindowInfo^.Overlay<>HWND(nil) then
@ -1676,8 +1658,6 @@ begin
if Assigned(lWinControl) and not (lWinControl is TCustomForm) then
EnableChildWindows(lWinControl, WParam<>0);
if (lWinControl is TCustomFloatSpinEdit) then
EnableFloatSpinEditBuddy(Window, WParam<>0);
// ugly hack to give bitbtns a nice look
// When no theming active, the internal image needs to be
// recreated when the enabled state is changed

View File

@ -88,16 +88,32 @@ function SpinWindowProc(Window: HWnd; Msg: UInt; WParam: Windows.WParam;
var
BuddyWindow: HWND;
begin
// before generic window proc
case Msg of
WM_DESTROY:
begin
BuddyWindow := GetBuddyWindow(Window);
DestroyWindow(BuddyWindow);
end;
WM_ENABLE:
begin
BuddyWindow := GetBuddyWindow(Window);
Windows.EnableWindow(BuddyWindow, WParam <> 0);
end;
end;
Result := WindowProc(Window, Msg, WParam, LParam);
if Msg = WM_SETFOCUS then
begin
BuddyWindow := GetBuddyWindow(Window);
Windows.SetFocus(BuddyWindow);
// don't select text in edit, if user clicked on the up down and the edit
// was already focused
if HWND(WPARAM)<>BuddyWindow then ;
// for LCL controls this is done in win32callback.inc
Windows.SendMessage(BuddyWindow, EM_SETSEL, 0, -1);
// after generic window proc
case Msg of
WM_SETFOCUS:
begin
BuddyWindow := GetBuddyWindow(Window);
Windows.SetFocus(BuddyWindow);
// don't select text in edit, if user clicked on the up down and the edit
// was already focused
if HWND(WPARAM)<>BuddyWindow then ;
// for LCL controls this is done in win32callback.inc
Windows.SendMessage(BuddyWindow, EM_SETSEL, 0, -1);
end;
end;
end;