DBGrids and the drop down box


2003-09-15 12:33:30 AM
cppbuilder76
Hi,
I cannot follow where the TPopupListbox.Keypress(var Key: Char)
procedure in DBGrids goes after sending off the select message
[SendMessage(Handle, LB_SelectString, WORD(-1),
Longint(PChar(FSearchText)));]. Attempting to debug doesn't work
because the list box is closed when focus shifts to the de{*word*81}. So
does someone know where the function that selects the string is? I want
to make it so that the strings start on the top of the box rather than
all of the string preceding the select being shown (current behavior).
Thanks,
Charlie
I am looking at DBGrids and the following function:
procedure TPopupListbox.Keypress(var Key: Char);
var
TickCount: Integer;
begin
case Key of
#8, #27: FSearchText := '';
#32..#255:
begin
TickCount := GetTickCount;
if TickCount - FSearchTickCount>2000 then FSearchText := '';
FSearchTickCount := TickCount;
if Length(FSearchText) < 32 then FSearchText := FSearchText + Key;
SendMessage(Handle, LB_SelectString, WORD(-1),
Longint(PChar(FSearchText)));
Key := #0;
end;
end;
inherited Keypress(Key);
end;