Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread my first attempt
Tue, Dec 8 2015 6:17 AMPermanent Link

Riaz

here is my first attempt to load a database, search by product code or by label

thank you for all your help

http://www.epos4bars.com/products.html

all = list all the database
label button = search by label keyword
p.code = search by productcode keyword

thanks
Riaz
Tue, Dec 8 2015 9:04 AMPermanent Link

Matthew Jones

Riaz wrote:

> here is my first attempt to load a database, search by product code
> or by label

Given you have prices, I think that they should have the same number of
decimals. You probably also want to have it do the search when anyone
types any character (any change to the edit box). And do both at the
same time. So I could type "coke" and the list would be showing the
results narrow as I do. I'd keep the text too - clearing it means I
have to retype, but you could have a "clear" button to do that if it
will be necessary.

--

Matthew Jones
Tue, Dec 8 2015 9:15 AMPermanent Link

Riaz

Thank you Mathew,
i was just testing if i could pull the data from EWB server

will now try and see how i can put the price as 2 decimal places

thank you
Tue, Dec 8 2015 9:33 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Matthew

>Given you have prices, I think that they should have the same number of
>decimals. You probably also want to have it do the search when anyone
>types any character (any change to the edit box). And do both at the
>same time. So I could type "coke" and the list would be showing the
>results narrow as I do. I'd keep the text too - clearing it means I
>have to retype, but you could have a "clear" button to do that if it
>will be necessary.

I agree with you about the prices

Given that I don't use EWB I may be being a complete moron here but I recommend that rather than responding to every edit change you have a timer linked to changes (I use the key up/down to cope with backspace etc) in the edit box an respond to the value of the edit box in there. DoFind.Interval is set to 150 which is short enough not to annoy and long enough to allow typing

In Delphispeak

procedure TCompaniesForm.FinderKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
DoFind.Enabled := False;
end;

procedure TCompaniesForm.FinderKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
DoFind.Enabled := True;
end;


procedure TCompaniesForm.DoFindTimer(Sender: TObject);
begin
DoFind.Enabled := False;
if (Finder.Text <> '') and (Finder.Text[1] <> '=')
 then Companies.Locate('_Name', Finder.Text, [loCaseInsensitive, loPartialKey])
else Companies.Locate('_ID', StrToIntDef(Copy(Finder.Text, 2, MaxInt), -1), []);
end;

This one just does a locate, and is the first example I found. For filtering I use a slightly different strategy. Dump the KeyDown event, have a global string variable that's set in the timer event after setting the filter, and checked against the edit.text to see if the filter needs refreshing in the first place.

Roy Lambert
Tue, Dec 8 2015 9:42 AMPermanent Link

Riaz

Roy Lambert,
thank you

Riaz
Tue, Dec 8 2015 9:49 AMPermanent Link

Matthew Jones

Roy Lambert wrote:

> recommend that rather than responding to every edit change you have a
> timer linked to changes

Now you're just getting fancy! 8-)

--

Matthew Jones
Tue, Dec 8 2015 10:29 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Matthew

>Now you're just getting fancy! 8-)

Nah - just copying those better than me.

My "refinement" was to use keyup/down rather than keypress

Roy
Image