[Lazarus] RE : RE : RE : RE : RE : @DBLookupControls users: call for test

Ludo Brands ludo.brands at free.fr
Wed Dec 14 12:08:21 CET 2011


> 
> I've got your point.
> 
> Mine is that the control should keep less intrusive as it was 
> designed 
> earlier (the original author explicitly avoided changing 
> listsource cursor).
> 

Less intrusive became occulted. Not only are we missing an important (for me
at least) Delphi feature but the current implementation makes it virtually
impossible to emulate the Delphi behavior since everything related to the
lookup is private: 
A convoluted workaround for DBLookupComboBox was to create a
DBLookupComboBox.OnChange, retrieve DBLookupComboBox.ItemIndex and move its
listsource to that position. Unfortunately, recent changes have made this
even more difficult since DBLookupComboBox2.ListSource returns nil if
Datafield is a lookup field. Setting ListSource when Datafield is ftLookup
was superfluous but possible and useful. Beats me why this was removed.
Progress? Now I have to get the field information of DataField to get to the
ListSource :
DBLookupComboBox.DataSource.DataSet.FieldByName(DBLookupComboBox.DataField).
LookupDataSet.RecNo:=DBLookupComboBox.ItemIndex+1 :(  I'll create a seperate
bugreport for this regression. Even if ListSource isn't settable for a
ftLookup Datafield, it shouldn't return nil.

DBGrid is even worse. For the picklist I haven't found anything (event or
property) to get to its index or value.

The remedy for being less intrusive is worse than the disease.


> With this it can have more granular usage for those that dont want to 
> interfere to the dataset position and also for those that 
> want to change 
> it, and know the collateral effects, just add a single call 
> to Locate in 
> OnSelect or OnEditingDone
> 

As written before, if you don't want 'collateral' effects, don't use a list
datasource that is active in another control. In the current implementation
there are also 'collateral' effects: fe. the order of elements in the lookup
dataset is the same as the original dataset. Changing the sort order in the
original dataset, changes the order in the  dblookupcontrol. Apply a filter
to the dataset and the dblookupcontrol is filtered also. Why wanting to
break this link in one direction only? 

> I will concentrate in the remaining bugs
> 

That's indeed a privilege that comes with developer status...

Ludo





More information about the Lazarus mailing list