Subject Re: [IBO] Grid or list selection with only one column
Author Antti Kurenniemi
>>Hiya.
>>
>>
>>This is probably very simple, I just can't figure it out myself: I want to
>>have a list of names in a list, and all detail edits on the same window
>>linked to the list so that when the user clicks on the list the edits
>>would
>>be filled in. Real easy to do with all columns, with a Query component and
>>a
>>Datasource component, except that if the query has many columns (or a very
>>simple "select * from...), the list will show all columns as well.
>>
>>I've tried it with IB_Grid, IB_Listbox and IB_Lookuplist, but can't figure
>>out how to force just the columns I want to be shown. Or, do I need to
>>have
>>separate queries or datasources, or something? I can hack it by making one
>>query to fill the list, and then a second query to fill all the edits when
>>the selection in the list changes, but somehow I feel that there is
>>probably
>>an easier way...
>
> Use the FieldsVisible property of the IB_Dataset to hide fields that you
> don't want show in multi-column controls. This property applies to all
> multi-column controls bound to that dataset. Hint: you can access the
> FieldsXXX properties at design-time, in the dataset editor, by
> double-clicking on the IB_Query object.

Thanks, I completely missed that dialog.

>>Oh, and btw: I couldn't get anything to display in the IB_Listbox, by just
>>filling in the Datasource and DataField properties. Is there something
>>else
>>I need to do with it?
>
> Yes: you have to populate the Items property of the control. :-) The
> Datasource property binds the control to the dataset; DataField binds
> it to the column that it will represent.

So it's not "automatic" like the grids?


> Items is a TStringList. You can add the items at design-time, in
> the Items editor, or at run-time, e.g.

Alrighty, works like a regular TListBox.


> Some multi-row controls are "double data-aware" - such as
> TIB_LookupCombo and TIB_LookupList. By
> "double-data-aware" means that the lookup part is bound to
> one dataset whilst the value of the currently selected list item
> is bound to the current record of another.

So I could for example show customers in a lookup combo, displaying the name
of the customer to the user and having a customer class ID as the "hidden"
value linked to another dataset, so that when the user selects a customer,
there could be another display showing the details of the customer class
that particular customer belongs to? Ok, sounds like there are only about a
million uses for this ;-)


> The binding mechanism for these controls is different;
> and they also have a GridLinks property that can
> optionally be used to override, for that control only, the
> columns determined by the dataset's FieldsVisible property.
>
> Double-data-aware controls are another chapter. :-)

More reading for me :-) Thank you for this information.


Antti Kurenniemi