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);
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
msimg32lib = 'msimg32.dll';
@ -876,7 +895,9 @@ begin
begin
p := GetProcAddress(user32handle, 'GetComboBoxInfo');
if p <> nil then
Pointer(GetComboboxInfo) := p;
Pointer(GetComboboxInfo) := p
else
Pointer(GetComboboxInfo) := @_GetComboboxInfo;
end;
end;

View File

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

View File

@ -46,7 +46,7 @@ Type
AWinControl: TWinControl; // control associated with (for buddy controls)
List: TStrings;
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
isTabPage: boolean; // is window of tabpage
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;
var
Params: TCreateWindowExParams;
Info: TComboboxInfo;
begin
// general initialization of Params
PrepareCreateWindow(AWinControl, Params);
@ -758,10 +759,13 @@ begin
// combobox is not a transparent control -> no need for parentpainting
Params.WindowInfo^.needParentPaint := false;
Info.cbSize:= SizeOf(Info);
Win32Extra.GetComboBoxInfo(Params.Window, @Info);
// get edit window within
with Params do
begin
Buddy := Windows.GetTopWindow(Window);
Buddy := Info.hwndItem;
// If the style is CBS_DROPDOWNLIST, GetTopWindow returns null,
// because the combobox has no edit in that case.
if Buddy <> HWND(nil) then
@ -774,7 +778,6 @@ begin
else
BuddyWindowInfo:=nil;
end;
Result := Params.Window;
end;