Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

accept wildcard in stringgrid lookup 1

Status
Not open for further replies.

CliffClimber

Technical User
Sep 18, 2003
16
US
Hi,
I am using a TStringGrid and a TDBGrid in a lookup program, and would like to add the capability to search using a wildcard like " * " in the search. All 4 search fields are Character fields. Could someone shed some light on how I need to go about doing this?
Thanks!
Cliff
 
Can you be more precise about your problem? In which component are the asterisks going? Are you using TTable or SQL for database access? Presumably the search results are to appear in one or both grids...
 
I believe it is set up using TTable with an Advantage local client server, as the search is implemented using Filters. TStringGrid accepts the user inputs and matches are displayed in the TDBGrid, nothing but the user input shows in the StringGrid. I do not fully understand exactly how the filters do their stuff yet, I'm just starting to learn about them. The following script appears to setup the search. Let me know if you need to see more!
Thanks, Cliff

[script]

procedure TFormMain.SelectGridSetEditText(Sender: TObject; ACol,
ARow: Integer; const Value: String);
begin
if IsEmpty(FilterSearch) and (Value <> '') then begin
OrderCol := ACol;
end;
if FilterSearch[Acol] <> Value then begin
FilterSearch[Acol] := Value;
NewSearch;
end;
end;

function TFormMain.IsEmpty(StringList : TStringList) : Boolean;
var I : Integer;
begin
Result := True;
for I := 0 to StringList.Count-1 do begin
if StringList <> '' then begin
Result := False;
break;
end;
end;
end;

procedure TFormMain.NewSearch;
begin
AboutToSearch := True;
Screen.Cursor := crHourGlass;
try
ApplyRange;
ApplyFilter;
finally
AboutToSearch := False;
MainData.AfterScroll(MainData);
Screen.Cursor := crDefault;
end;
end;

[/script]
 
I'm afraid that I have no experience of using filters nor of Advatage either. As a result (or it may just be my general ignorance), I am struggling to guess at what is happening in MainData(AfterScroll), ApplyRange etc. I don't think that without your environment, and probably quite some time, I would be able to help much.
Sorry about that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top