How about something like :-
 
// call from keypress
procedure automatch(cbo : tcombobox; var keyascii : char);
var
  sbuffer : pchar;
  s :string;
  retval  : longint;
begin
  getmem(sbuffer,255);
  try
    s := copy(cbo.text,1,cbo.selstart) + (keyascii);  {needs a tidy here}
    strpcopy(sbuffer,s);
    retval := sendmessage(cbo.handle,CB_FINDSTRING,word(-1),longint(sbuffer));
    if retval <> CB_ERR then
    begin
      cbo.ItemIndex := retval;
      cbo.text := cbo.Items.Strings[retval];
      cbo.selstart := length(s);
      cbo.SelLength := length(cbo.text);
      keyascii := chr(0);  {supress if called from keypress}
    end
    else
    begin
      cbo.itemindex := -1;
      cbo.text := s;
      cbo.selstart := length(s) ;
    end;
  finally
    freemem(sbuffer,255);
  end;
end;
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Mark Howard
Sent: Saturday, August 12, 2000 4:12 AM
To: Multiple recipients of list delphi
Subject: [DUG]: Special ComboBox

Hello
Does anyone have (or can refer me to) a ComboBox component that will incrementally home in on an entry in it's listbox as further keys are pressed (ie rather than repositioning the cursor at the first item in the list beginning with each subsequent keypress). - so keying B and then R would position the cursor on the first item in the list beginning with BR.
Thanks
Mark
 
 
 
 

Reply via email to