Subject Re: [IBO] Re: IB_Combox and IB_Grid again
Author Geoff Worboys
> Why not simply return the field Value in IBG_GetText ,
>
> function TIB_CustomComboBox.IBG_GetText: string;
> begin
> if Assigned( Field ) then
> // Result := Items.Strings[ ItemValues.IndexOf(
> Field.DisplayText ) ]
> Result := Field.DisplayText
> else
> Result := '';
> end;

The GetText interface function is for returning the display text
appropriate to the current value of the control (the currently
selected field). You will notice that the GetText function has no
parameter - because it will use the value of the current field. And
thanks for the reminder, this function will also need updating to cope
with csDropDown style (and lack of ItemValues definition) - probably
this function could just be...

function TIB_CustomComboBox.IBG_GetText: string;
begin
if Assigned( Field ) then
Result := IBG_TranslateText( Field.DisplayText )
else
Result := '';
end;

The TranslateText function is usually called when processing other
than the current row. It takes a parameter which is the value that
you want to translate from text representing the stored value, into
the text to be displayed.


If you use the updated GetText shown above with the updated
TranslateText I posted earlier - does this do what you need?


HTH

Geoff Worboys
Telesis Computing