fix key handling of edit part of csSimple combobox (0007318)

git-svn-id: trunk@14249 -
This commit is contained in:
paul 2008-02-26 02:31:35 +00:00
parent f1b2949f86
commit a5b4f9d12f
4 changed files with 29 additions and 5 deletions

View File

@ -834,6 +834,25 @@ begin
Result := _AlphaBlend(hdcDest, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, hdcSrc, nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, blendFunction); Result := _AlphaBlend(hdcDest, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, hdcSrc, nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, blendFunction);
end; end;
function _GetComboboxInfo(hwndCombo: HWND; pcbi: PComboboxInfo): BOOL; stdcall;
begin
Result := (pcbi <> nil) and (pcbi^.cbSize = SizeOf(TComboboxInfo));
if Result then
begin
pcbi^.hwndCombo := hwndCombo;
if (GetWindowLong(hwndCombo, GWL_STYLE) and CBS_SIMPLE) <> 0 then
begin
pcbi^.hwndList := GetTopWindow(hwndCombo);
pcbi^.hwndItem := GetWindow(pcbi^.hwndList, GW_HWNDNEXT);
end
else
begin
pcbi^.hwndItem := GetTopWindow(hwndCombo);
pcbi^.hwndList := 0;
end;
end;
end;
const const
msimg32lib = 'msimg32.dll'; msimg32lib = 'msimg32.dll';
@ -876,7 +895,9 @@ begin
begin begin
p := GetProcAddress(user32handle, 'GetComboBoxInfo'); p := GetProcAddress(user32handle, 'GetComboBoxInfo');
if p <> nil then if p <> nil then
Pointer(GetComboboxInfo) := p; Pointer(GetComboboxInfo) := p
else
Pointer(GetComboboxInfo) := @_GetComboboxInfo;
end; end;
end; end;

View File

@ -316,7 +316,7 @@ begin
else else
if SizeConstraints.Control is TCustomComboBox then if SizeConstraints.Control is TCustomComboBox then
begin begin
// win32 combo (bug not csSimple) has fixed height // win32 combo (but not csSimple) has fixed height
FixedHeight := TCustomComboBox(SizeConstraints.Control).Style <> csSimple; FixedHeight := TCustomComboBox(SizeConstraints.Control).Style <> csSimple;
end; end;

View File

@ -46,7 +46,7 @@ Type
AWinControl: TWinControl; // control associated with (for buddy controls) AWinControl: TWinControl; // control associated with (for buddy controls)
List: TStrings; List: TStrings;
DisabledWindowList: TList;// a list of windows that were disabled when showing modal DisabledWindowList: TList;// a list of windows that were disabled when showing modal
StayOnTopList: TList; StayOnTopList: TList; // a list of windows that were normalized when showing modal
needParentPaint: boolean; // has a tabpage as parent, and is winxp themed needParentPaint: boolean; // has a tabpage as parent, and is winxp themed
isTabPage: boolean; // is window of tabpage isTabPage: boolean; // is window of tabpage
isComboEdit: boolean; // is buddy of combobox, the edit control isComboEdit: boolean; // is buddy of combobox, the edit control

View File

@ -740,6 +740,7 @@ class function TWin32WSCustomComboBox.CreateHandle(const AWinControl: TWinContro
const AParams: TCreateParams): HWND; const AParams: TCreateParams): HWND;
var var
Params: TCreateWindowExParams; Params: TCreateWindowExParams;
Info: TComboboxInfo;
begin begin
// general initialization of Params // general initialization of Params
PrepareCreateWindow(AWinControl, Params); PrepareCreateWindow(AWinControl, Params);
@ -758,10 +759,13 @@ begin
// combobox is not a transparent control -> no need for parentpainting // combobox is not a transparent control -> no need for parentpainting
Params.WindowInfo^.needParentPaint := false; Params.WindowInfo^.needParentPaint := false;
Info.cbSize:= SizeOf(Info);
Win32Extra.GetComboBoxInfo(Params.Window, @Info);
// get edit window within // get edit window within
with Params do with Params do
begin begin
Buddy := Windows.GetTopWindow(Window); Buddy := Info.hwndItem;
// If the style is CBS_DROPDOWNLIST, GetTopWindow returns null, // If the style is CBS_DROPDOWNLIST, GetTopWindow returns null,
// because the combobox has no edit in that case. // because the combobox has no edit in that case.
if Buddy <> HWND(nil) then if Buddy <> HWND(nil) then
@ -774,7 +778,6 @@ begin
else else
BuddyWindowInfo:=nil; BuddyWindowInfo:=nil;
end; end;
Result := Params.Window; Result := Params.Window;
end; end;