BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to use TDBGrid.Column.PickList

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Desktop)
View previous topic :: View next topic  
Author Message
Camiel Wijffels
Guest





PostPosted: Thu Nov 18, 2004 9:48 pm    Post subject: How to use TDBGrid.Column.PickList Reply with quote



(sorry for reposting, but this newsgroup seems more appropriate)
-------------------------
How do I use DBGrid.Column.PickList ? I can make a picklist, which shows in
the DBGrid editor at runtime. But how do I know which string (or which
itemindex) is selected within the PickList? All together, how do I exactly
use the PickList?
--
Best regards, Camiel Wijffels


Back to top
Wayne Niddery [TeamB]
Guest





PostPosted: Thu Nov 18, 2004 11:39 pm    Post subject: Re: How to use TDBGrid.Column.PickList Reply with quote



Camiel Wijffels wrote:
Quote:
How do I use DBGrid.Column.PickList ? I can make a picklist, which
shows in the DBGrid editor at runtime. But how do I know which string
(or which itemindex) is selected within the PickList? All together,
how do I exactly use the PickList?

Just add the values you need and you're done. You can then click in that
column and the DBGrid will make a dropdown accessble so you can choose the
value.

The values you specify are what go into the field so, for example, if you
want a pick list for State and you need the 2 character state abbreviations
in the field then that is all you can display in the picklist.


--
Wayne Niddery - Logic Fundamentals, Inc. (www.logicfundamentals.com)
RADBooks: http://www.logicfundamentals.com/RADBooks.html
"A man is likely to mind his own business when it is worth minding,
when it is not, he takes his mind off his own meaningless affairs by
minding other people's business." - Eric Hoffer



Back to top
Camiel Wijffels
Guest





PostPosted: Fri Nov 19, 2004 6:18 am    Post subject: Re: How to use TDBGrid.Column.PickList Reply with quote



"Wayne Niddery [TeamB]" <wniddery (AT) chaffaci (DOT) on.ca> schreef in bericht
news:419d32ba (AT) newsgroups (DOT) borland.com...
Quote:
Camiel Wijffels wrote:
How do I use DBGrid.Column.PickList ? I can make a picklist, which
shows in the DBGrid editor at runtime. But how do I know which string
(or which itemindex) is selected within the PickList? All together,
how do I exactly use the PickList?

Just add the values you need and you're done. You can then click in that
column and the DBGrid will make a dropdown accessble so you can choose the
value.

I have 'studied' the picklist for several hours now. I'm able to create a
picklist by adding values to it and assigning a field to the column. If the
field is not a calculated field then no picklist appears - so the field
should be calculated as far as I know. But it seems impossible to get the
clicked value or index. When looking with WinSight32 it seems that only a
few LB_ (listbox) events appear which contian the correct clicked index. So
my question remains how to go ahead?

Actually my entire question is a little different. I have a list of indices
(Product, Scrap, Rework and others), listed as integers in a shortint
database field. I want to use the full names when selecting from these
items, so the values in the picklist are Product, Scrap and Rework. But then
some value should return so I can set the correct index in the database
field. I thought the picklist was ideal for this case, but I still cant get
back which index I choose.
--
Best regards, Camiel Wijffels



Back to top
Quasidata
Guest





PostPosted: Fri Nov 19, 2004 10:56 am    Post subject: Re: How to use TDBGrid.Column.PickList Reply with quote

Hello Camiel,

I guess you confuse PickList with LookupList. Those are two different
things, even so they look similarly for the user. They are even described in
a common topics in the help, but you need to distinguish them.

To setup a PickList is quite easy. It is a property of TColumn. You populate
it explicitly yourself.

LookupList is populated implicitly based on lookup settings for the field
linked to the column. To set up it correctly is not easy, but possible :-)

--
Andrei Fomine www.quasidata.com
DbAltGrid - multi-line layout, RTF and graphics of any kind in DBGrid.
Transfer@Once - full-blown clipboard and drag-and-drop data transfer to/from
any control in many formats, including ones native to MS Office.


"Camiel Wijffels" <Remove (AT) Me (DOT) Com> wrote

Quote:
"Wayne Niddery [TeamB]" <wniddery (AT) chaffaci (DOT) on.ca> schreef in bericht
news:419d32ba (AT) newsgroups (DOT) borland.com...
Camiel Wijffels wrote:
How do I use DBGrid.Column.PickList ? I can make a picklist, which
shows in the DBGrid editor at runtime. But how do I know which string
(or which itemindex) is selected within the PickList? All together,
how do I exactly use the PickList?

Just add the values you need and you're done. You can then click in that
column and the DBGrid will make a dropdown accessble so you can choose
the
value.

I have 'studied' the picklist for several hours now. I'm able to create a
picklist by adding values to it and assigning a field to the column. If
the
field is not a calculated field then no picklist appears - so the field
should be calculated as far as I know. But it seems impossible to get the
clicked value or index. When looking with WinSight32 it seems that only a
few LB_ (listbox) events appear which contian the correct clicked index.
So
my question remains how to go ahead?

Actually my entire question is a little different. I have a list of
indices
(Product, Scrap, Rework and others), listed as integers in a shortint
database field. I want to use the full names when selecting from these
items, so the values in the picklist are Product, Scrap and Rework. But
then
some value should return so I can set the correct index in the database
field. I thought the picklist was ideal for this case, but I still cant
get
back which index I choose.
--
Best regards, Camiel Wijffels




Back to top
Wayne Niddery [TeamB]
Guest





PostPosted: Fri Nov 19, 2004 3:19 pm    Post subject: Re: How to use TDBGrid.Column.PickList Reply with quote

Camiel Wijffels wrote:
Quote:

I have 'studied' the picklist for several hours now. I'm able to
create a picklist by adding values to it and assigning a field to the
column.

It sounds like we're talking about two different things. a PickList is a
property of TColumn in the DBGrid. Is that what you are talking about?

Quote:
If the field is not a calculated field then no picklist
appears - so the field should be calculated as far as I know.

If you are talking about a DBLookupComboBox control, then you do not need or
want a calculated field.

Quote:
Actually my entire question is a little different. I have a list of
indices (Product, Scrap, Rework and others), listed as integers in a
shortint database field. I want to use the full names when selecting
from these items, so the values in the picklist are Product, Scrap
and Rework. But then some value should return so I can set the
correct index in the database field. I thought the picklist was ideal
for this case, but I still cant get back which index I choose.

If the possible values (Descriptive name and integer value) are stored in a
database table, then DBLookupComboBox is what you want. Set the Listsource,
ListFieldIndex, ListField, and Keyfield properties to this table and the
Datasource and DataField to the table you want the value assigned to.

If these values are not in their own table, there are a couple of ways to
deal with it. One would be to populate a memory dataset which would allow
you to still use a DBLookupComboBox. Another way is to a non-data-aware
combobox, assign the possible values at design time (Produc, Scrap, etc) and
when a record is scrolled, set the ItemIndex to the field value, when the
user selects a value, assign it's itemindex to the field.

--
Wayne Niddery - Logic Fundamentals, Inc. (www.logicfundamentals.com)
RADBooks: http://www.logicfundamentals.com/RADBooks.html
"The only reason some people get lost in thought is because it's
unfamiliar territory." - Paul Fix



Back to top
Camiel Wijffels
Guest





PostPosted: Fri Nov 19, 2004 5:40 pm    Post subject: Re: How to use TDBGrid.Column.PickList Reply with quote

Thank you both for responding.
I really ment a PICKLIST, and I already found the solution. I have to link a
real datafield to the column, and in the OnSetText and OnGetText I'll have
to change the look of the values from integer to string.

As I said I have an integer field which should correspond to 0 - Product,
1 - Scrap and 2 - Rework. So the user enteres a logic value (Product, Scrap,
Rework) which internally is translated to an integer value - and I
succeeded. Thank you all
--
Best regards, Camiel Wijffels


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Desktop) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.