Subject Re: [IBO] Help with Descending from TIB_CustomCombo
Author Mark Pickersgill
Hi Paul,

Thanks for the response.

PV> When you say "listing", do you mean the entire interface and
PV> implementation for TIB_LookupCombo and TIB_LookupComboLink? (But with
PV> different names for both.)

It was ONLY the TIB_LookupCombo class interface that I copied...I
was just trying to mimic what was done in TIB_Grid and how
TIB_LookupCombo was declared.

The "DataLink" property is from the "PopupList" property of the
TIB_CustomCombo. From IB_Grids.pas:

procedure TIB_CustomCombo.KeyPress( var Key: Char);
inherited KeyPress(Key);
if Assigned( PopupList ) then with PopupList.DataLink do

So if this method (KeyPress) is copied accross to the new
TIB_LookupComboB component's overriden "KeyPress" method, then this
is where the error occurs (in TIB_LookupComboB.KeyPress)

I'll take a closer look at the TIB_LookupComboLink to see where it
fits in with things, but it wasn't obvious to me at the time that I
had to do anything with it.

PV> "DataLink" is a TIB_LookupComboLink. Maybe you haven't copied all the
PV> logic correctly. Or - in the case you didn't copy the interface from
PV> TIB_LookupCombo - maybe you haven't published the necessary properties.

The interface for TIB_LookupComboB was copied directly from
TIB_LookupCombo in IB_Grids.pas. TIB_LookupCombo is (according to
the code), an inherited TIB_CustomCombo with published properties.

PV> I can't tell exactly what happens here, but as a general advice: if
PV> you want to mimic another component almost exactly and only change a
PV> couple of things, don't descend from that component's ancestor, but
PV> from the component itself, and override the methods you want to
PV> implement differently:

Agreed. However, this is not always possible and also I'm trying to
get a better understanding as to how the nuts and bolts of the GUI
components in IBO work and fit together.

When I get home I will review and see if I can inherit straight from
TIB_LookupCombo. I'll also put up a basic component that causes the
errors for anyone interested in a challenge :)

thanks again.