TAdvStringGrid Cell Highlighting

I'm attempting to provide a function to allow a user to filter a grid's entries by typing a string into an external TEdit box.  I've already got the filtering up and running but I want what they've typed in to the box to be highlighted on the grid but can't seem to get this working.


Currently I'm populating and displaying the grid by adding an struct to column 0's object variable, then using the OnGetDisplText function to retrieve that row's object (i.e. grid->Objects[0][ARow]) and setting the Value to the appropriate value from the struct.

My question is whether the highlight functions can work with the OnGetDisplText value or just the grid->Cells[ACol][ARow] value.  

I've tried:

  • using grid->HilightInGrid(true, false, Edit->Text); which doesn't do anything.
  • getting my Value string from the OnGetDisplText function, then just before returning running Value = grid->HilightText(true, Value, Edit->Text); which highlights the required text but not in the colours I want.  I have set HighlightColor to clNone and HighlightTextColor to clGreen but the highlighted text comes out white, which makes it invisible since my background is white.

Thanks for your time.

Quick update:


tried manually populating the grid (setting grid->Cells[ACol][ARow] rather than using OnGetDisplText) and using grid->HilightInGrid(true, false, Edit->Text);.  This gave me the same outcome as using HilightText in the OnGetDisplText function, that is the text that was highlighted turned white with no highlighted backing, which made it invisible against my white background.  Setting HighlightColor and HighlightTextColor did not change the highlighted colour.

Another update:


I created a new VCL forms application (this is all C++ in RAD Studio XE3 Update 2 BTW) and added a new TAdveStringGrid.  Then, just like in the documentation demo I added these two lines:

  AdvStringGrid1->Cells[2][3] = "This is TMS software";
  AdvStringGrid1->HilightInGrid(false,false,"TMS");

This works fine and I can change the HighlightTextColor and HighlightColor to change the background and text colour of the TMS section of the text.

I then cut and pasted my grid from my application and built the new application, and the copy of my grid works fine too.  I then copied the first grid I created in my new test application into my old application and it gave me the same problem as my original grid.  I then deleted everything from my old application except for the two grids and the test populate/highlight code, with no success.  

This tells me that the problem lies within my Project options somewhere but I cannot think of what would be affecting this or see any major difference in the two project's options.  I am very confused here...