Topic: Can I slow down the text matching on a combobox

if you type really fast in a combo it will match entries and narrow your search - but I have a container list that all the number start with 1000 or 1001 and then have 6 more digits - then it runs out of time and doesn't match because of too many digits,  is there a property to change this or do I need to work around it.

The first thought I had was to have a button open a form where you can search with a text box and then select and pass that value back - I'm looking thru the examples to see if anyone has done that before.

Re: Can I slow down the text matching on a combobox

Unfortunately I do not know how to configure this.


May be will be better use TableGrid instead ComboBox, if you are using TableGrid you can use function Find (Ctrl+F)
Also you can use TextBox, button search and property Increm. Search of TableGrid for filtering record in TableGrid.


More info about property Increm. Search
https://translate.googleusercontent.com … p4hGUvVCSA

Dmitry.

Re: Can I slow down the text matching on a combobox

Thanks, I am trying that Increm. Search and it works ok, except for one complaint, in the TableGrid I need to only return the id no matter where you click on a row,

for example on the search button I have this sql
SELECT
  Id,ContainerDesc,inactive
FROM
  Containers
WHERE
  ContainerDesc
LIKE '%{ContainerDescs}%';
and filter out the inactive in the table grid
then in the tale grid if the user click the Id Column it works correctly but if they click the actual container description it returns the Description "as expected" but I need it to return only the Id

Is this a configuration I haven't found or do I need to use script to process the output of the table grid click to get the id?  in other words run another sql query to find the id from the ContainerDesc

something like

ContSTR := FillAContainer.TableGrid1.Cells(ACol, ARow);
Len := Length(ContSTR);
if (Len > 5) then
ContID := SQLExecute('SELECT Id FROM Containers WHERE ContainerDesc=' + ContSTR );
else;

Re: Can I slow down the text matching on a combobox

It worked

procedure FillAContainer_TableGrid1_OnCellClick (Sender: string; ACol, ARow: Integer);
var
   Ccapacity, Ctare, Cdotdate, Ccustomern,ContID: string;
   dt: TDateTime;
   rt,lastcust,ContSTR,Len: integer;
begin
     ContSTR := StrToInt(FillAContainer.TableGrid1.Cells(ACol, ARow));
     Len := Length(ContSTR);
     if (Len = 10) then
        ContID := SQLExecute('SELECT Id FROM Containers WHERE ContainerId=' + IntToStr(ContSTR) )
     else if (Len < 10) then
        ContID := FillAContainer.TableGrid1.Cells(ACol, ARow)
     else;
     //ShowMessage(ContID);
     FillAContainer.Containerid.dbItemID := StrToInt(ContID);
     Ccapacity := SQLExecute('SELECT ContainerCapacity FROM Containers WHERE id=' + ContID );
     Ctare := SQLExecute('SELECT ContainerEmpty FROM Containers WHERE id=' + ContID );
     Cdotdate := SQLExecute('SELECT DOTInspDate FROM Containers WHERE id=' + ContID );
     lastcust := SQLExecute('SELECT id_Customers, id_Containers, max(id) from FillRecords where id_Containers =' + ContID + ' AND returned = 0 group by id_Customers limit 1');
     Ccustomern := SQLExecute('select CustomerWholeName FROM Customers WHERE  id=' + IntToStr(lastcust) );
     // fill form fields
     FillAContainer.contcapacity.Text := Ccapacity;
     FillAContainer.prodTare.Text := Ctare;
     FillAContainer.dotinspDate.DateTime := SQLDateTimeToDateTime(Cdotdate);
     FillAContainer.filldate.DateTime := Now;
     FillAContainer.filldate.Checked := True;
     // code to pop up warning if dot inspection is too old
     dt := FillAContainer.filldate.DateTime - FillAContainer.dotinspDate.DateTime;
     if ((Trunc(dt/30)) >= 30) then
        ShowMessage('Warning this container has not been inspected in ' + IntToStr(Trunc(dt/30)) + ' Months, Please Select another Container, or Inspect his continaer before continuing.')
     else;
     rt :=2;
     // code to ask for container to be returned if it is currently out
     if (lastcust > 0) then
        ShowMessage('Warning this container has not been returned from ' + Ccustomern + ', Please Cancel and return the container before filling it again!')
     else;
end;

Re: Can I slow down the text matching on a combobox

All you need, this, for get id from TableGrid:

FillAContainer.TableGrid1.dbItemID;

dbItemID
Returns the value -1 if the entry in the table is not selected.


Example:

ShowMessage ('ID record:' + IntToStr (Form1.TableGrid1.dbItemID)); // Get selected record id 
Form1.TableGrid1.dbItemID: = 5; // Highlight row in the table, which is a record with ID 5
Dmitry.

Re: Can I slow down the text matching on a combobox

Thanks!  That is simpler.