Subject IB_ComboBox on a IB_Grid gives painting problems
Author Jeroen W. Pluimers (All I'M)
Jason,


When you drop an IB_ComboBox on an IB_Grid, and you associate the
IB_ComboBox with a column in the grid, then the column in the grid is not
painted any more.

This is contrary to an IB_LookupComboBox that does get painted correctly
inside an IB_Grid.

I'm probably overlooking something simple (I can't imagine this is a bug).
So: what am I doing wrong?

I made a temporary fix for myself, and it looks like this:

function TIB_CustomGrid.GetCellDisplayText( ACol, ARow: Longint ): string;
....

if Prepared then
begin
if ARow >= FixedRows then
for ii := 0 to ControlCount - 1 do
if Controls[ ii ] is TIB_CustomComboBox then
with Controls[ ii ] as TIB_CustomComboBox do
if Assigned( Field ) and ( AColumn = Field ) then
begin
tmpString := Items.Strings[ ItemValues.IndexOf( Result ) ];
if tmpString = '' then //##jp: Added
Result := Result //##jp: Added
else //##jp: Added
Result := tmpString;
end;
if Assigned( OnGetDisplayText ) then
OnGetDisplayText( Self, ACol, ARow, Result );
end;


Steps to reproduce:
- dump the components below on a form
- change the database name (in the params) if applicable
- make sure the Form.OnCreate executes this code:
IB_Query1.Open;
- run the application
- top grid does not show CUSTOMERNAME, but bottom grid does
- this is because the top grid has a IB_ComboBox on it


Jeroen W. Pluimers
All Information Management
http://www.all-im.com

================
object IB_Grid1: TIB_Grid
Left = 60
Top = 72
Width = 581
Height = 149
CustomGlyphsSupplied = []
DataSource = IB_DataSource1
TabOrder = 0
DefaultRowHeight = 17
object IB_ComboBox1: TIB_ComboBox
Left = 232
Top = 40
Width = 145
Height = 21
DataField = 'CUSTOMER'
DataSource = IB_DataSource1
Visible = False
TabOrder = 0
ItemHeight = 13
Items.Strings = (
'Sna'
'Foo'
'Bar')
end
end
object IB_Grid2: TIB_Grid
Left = 60
Top = 232
Width = 585
Height = 153
CustomGlyphsSupplied = []
DataSource = IB_DataSource1
TabOrder = 1
DefaultRowHeight = 17
end
object IB_Connection1: TIB_Connection
DatabaseName = 'Internal'
Params.Strings = (

'PATH=E:\Program Files\Common Files\Borland Shared\Data\employee.' +
'gdb'
'USER NAME=SYSDBA'
'PASSWORD=masterkey')
Left = 56
Top = 12
end
object IB_Query1: TIB_Query
DatabaseName = 'Internal'
IB_Connection = IB_Connection1
SQL.Strings = (
'SELECT *'
'FROM CUSTOMER')
ColorScheme = False
MasterSearchFlags = [msfOpenMasterOnOpen, msfSearchAppliesToMasterOnly]
BufferSynchroFlags = []
FetchWholeRows = True
Left = 144
Top = 12
end
object IB_DataSource1: TIB_DataSource
Dataset = IB_Query1
Left = 220
Top = 12
end
================
procedure MyForm.FormCreate(Sender: TObject);
begin
end;
================