RaymondC
  • RaymondC
  • Advanced Member Topic Starter
2017-06-05T22:21:54Z
I have one column with true/false values. After I populate the rows (with the FillFromRS method), I loop through the rows and if the value is true then I set the CellIcon property to index 1. If the value is false then I set the CellIcon to 0.

But the true/false text still shows. Is it possible to hide the true/false text and only show the icon?

Thanks.

Ray
Igor/10Tec
2017-06-06T12:26:19Z
We explain how to use the cell dynamic contents events in this scenario in the latest edition of the iGrid CHM help file. Below is an excerpt:

引用:

The ability to set cell icons on-the-fly can be helpful in many cases. For instance, you uploaded your data to the grid using the FillFromRS method, and one of your columns contains image indices. They were loaded as cell values and are displayed as text, but you can turn them into cell icons using the CellDynamicIcons event:



Private Sub iGrid1_CellDynamicIcons( _
      ByVal lRow As Long, ByVal lCol As Long, ByVal vValue As Variant, _
      btImageList As Byte, iIcon As Integer, btExtraImageList As Byte, iExtraIcon As Integer)

   If lCol = 1 Then iIcon = CInt(vValue)

End Sub

引用:

Pay attention to the fact that the icon indices still remain visible as cell texts. To suppress the output of these cell icon indices, use the CellDynamicText event:



Private Sub iGrid1_CellDynamicText( _
      ByVal lRow As Long, ByVal lCol As Long, _
      ByVal vValue As Variant, sText As String)
   
   If lCol = 1 Then sText = ""

End Sub

May we ask you, do you imitate real cell check boxes with icons this way? If so, then you could use FillFromRS to create check box columns for Boolean fields in the recordset and avoid all this work. Let us know if you experienced any troubles with using FillFromRS for this.
RaymondC
  • RaymondC
  • Advanced Member Topic Starter
2017-06-07T18:20:09Z
I decided to use a loop to manually set the icon and clear the text. This loop runs right after the FillFromRS method. My grid only has a few hundred rows and it runs very fast. I cannot tell any difference in speed if I comment out the loop.

I did this because I am trying to avoid using the CellDynamicIcons and CellDynamictext events since those events are disabled by default in v6.5 to improve performance (and reduce flicker) in MS Access.

Thanks.
Igor/10Tec
2017-06-08T05:43:00Z
Ok, understood why you do not want to use the dynamic content events. However, you did not answer - do you really need custom icons for the True/False values? Wouldn't it be better to use the built-in check box cells for that?

If possible, publish a screenshot of your grid here.
RaymondC
  • RaymondC
  • Advanced Member Topic Starter
2017-06-08T06:30:07Z
In this case, yes custom icons are better than check boxes.

grid icons.jpg

Click to View Image92 View(s)