Re: TZF - Sorting in TTzComboBoxes
Marie Vihonsky <[email protected]> Sun, 31 Aug 2003 18:49:57 -0400
| Newsgroups | gmane.comp.lang.delphi.topaz |
|---|---|
| Message-ID | <[email protected]> |
Hi Jerry,
I can't help you with Quickreport - I don't use it, but for the
TTzComboBoxes I might be able to. First, if the choices for the
combobox doesn't change from record to record, then you only need to
load it once, and you could load it in the form's OnActivate (or
OnCreate if the database is open). This is the code you currently have
in the 'motherboardOnEnter' routine. I usually make a procedure called
'Load_ComboBox'.
If the choices do change based on a selection in another field (or
combobox) then you do have to re-load, but the re-load is done in the
'first selected combobox' not the current one. Are you allowing the user
to 'enter new products'? Or must they select only from your choices? If
only from your choices, then you could do the following in the Object
Inspector for the combobox:
sorted = true;
style = csDropDownList;
Then when the user enters the combobox, they can then type the first
letter or so, and the item will be selected.
In the 'OnExit' routine, you would use the 'setfield' procedures for the
database, so that when they do a save, the selected info will be saved.
How are you saving the data? Are you using a TzNavigator or your own code?
If I'm not making sense, sorry, I just got back home and I'm tired.
Marie
Jerry Mallett wrote:
> HELP........Struggling NEWBIE AGAIN !!!!!!!!!!!!!
> Trying to build his first decent application to help with my business..
>
> Here's hoping I can explain my problem properly......
>
> I have two Forms.
> one which contains a QuickReport ( and thats a whole other story lol )
> while the other one is full of data entry fields.
>
> The data entry one is to facilitate in house quotations and contains a
> number of
> TTzComboBox's. Each one linked to a specific field in my products
> database.
>
> My products need to be sorted when I click the dropdown list icon and I
> tried using the "product.sorted" command but it then requires two clicks
> to
> drop the list and when the list drops creates two copies of each
> product.
>
> I'm using two events for the TTzComboBoxes... OnChange & OnEnter and
> they
> look like so.............
>
> procedure TQuoteForm.mboardEnter(Sender: TObject);
> // Motherboard selection
> Var pd, pc : string;
> // pd = Product Description & pc = Product Code
> begin
> DataMod.Products.Active := True;
>
> mboard.sorted := True;
> // Tried to sort dropdown list here with above line and it
> // does sort it but it produces two of everything and I
> // have to click twice to drop the list.
>
> mboard.Items.Add('No Selection'); // Add a "No Selection" option
> While NOT DataMod.Products.dEOF Do
> Begin
> If Trim(DataMod.Products.GetCField('PRODGROUP')) = 'PROD_MBRD' Then
> Begin
> pd := Trim(DataMod.Products.GetCField('PRODDESC'));
> pc :=
> LPad(IntToStr(DataMod.Products.GetLongField('ProdCode')),4);
> UnitPrice := DataMod.Products.GetRealField('oneoff');
> mboard.Items.Add(pd+' - ('+pc+') £'+SReal(UnitPrice,6,2));
> End;
> DataMod.Products.skip(1);
> End;
> DataMod.Products.Active := False;
> end;
>
> procedure TQuoteForm.mboardChange(Sender: TObject);
> Begin
>
> // here we extract the revelant info like product name, code,
> // net price etc.,
>
> mboard.sorted := True;
>
> // Tried to sorth the dropdown list with the above line here but it
> // won't sort
>
> end;
>
> I was trying to use a TzVFile and sort it prior to dropping this list
> but I'm finding this impossible to do as well.
>
> I saw Marie Vihonsky's reference to it, (TzVFile), in a recent
> posting....
> but I'm afraid it went way way over my head as did Chris Morgan's.
>
> Sorry guys.....but I'm a little long in the tooth and the old grey brain
> cells
> are fading fast.......I'm 49, 50 come October, and I'm a self taught
> computer
> technician. Left school at 15 and had a number of jobs over the years.
> Started
> repairing, Building and upgrading PC's in 1985 and own my own repair
> shop.
> In what little free time I have I try to get to grips with as wide a
> range of
> software products as I can and have mastered quite a few.
> Programming tho is a little more time consumming and if you leave if for
> a few
> weeks it's hard to remember where you left of...
>
> Why am I telling you all this??????
>
> So that you'll go easy on me of course...........lmao
>
> Many thanks for the help in advance...
>
>
>
--^----------------------------------------------------------------
This email was sent to: [email protected]
EASY UNSUBSCRIBE click here: http://topica.com/u/?clvXPN.a5kvff.Z2NsZHQt
Or send an email to: [email protected]
TOPICA - Start your own email discussion group. FREE!
http://www.topica.com/partner/tag02/create/index2.html
--^----------------------------------------------------------------