RaymondC
  • RaymondC
  • Advanced Member Topic Starter
2014-06-06T20:47:45Z
The column headers disappear when grid is disabled. Is there any way to prevent this behavior?
Igor/10Tec
2014-06-09T08:37:20Z
Send us please a sample and some screenshots of the problem. Tell us also what development environment and OS you are using.
RaymondC
  • RaymondC
  • Advanced Member Topic Starter
2014-06-09T16:14:06Z
The problem is happening in Access 2010. Windows 7 Pro. 64-bit.

I attached a screenshot of the problem. In the bottom section, the grid has its enabled property set to false. This causes the column headers to disappear which doesn't look too good.

Thanks.
RaymondC attached the following image(s):
Igor/10Tec
2014-06-10T07:59:52Z
Then it is a next glitch of MS Access. We use the standard MS Header control (from the very OS) as the iGrid header to have the same look-and-feel, and it works ok in all other development environments - even in VBA in MS Word/Excel (in UserForms).

I think we can do nothing with this, but I can suggest to find a workaround. Can I ask you, why do you want to make the whole grid disabled? Maybe, you just need to make it non-editable? In this case you can set the Editable property to False.
RaymondC
  • RaymondC
  • Advanced Member Topic Starter
2014-06-10T20:13:13Z
Making the grid non-editable is helpful but I would also need to prevent a user from changing the current selection.
Igor/10Tec
2014-06-12T14:56:09Z
As one of the possible solutions you could temporarily prohibit any keyboard and mouse activity using the bDoDefault argument of such events as KeyDown and MouseDown.
RaymondC
  • RaymondC
  • Advanced Member Topic Starter
2014-06-24T17:10:23Z
Thanks for the suggestions. I'll just have to accept this as a glitch of Access.
Igor/10Tec
2016-11-24T15:09:48Z
Another developer using iGrid in MS Access, Eckhard Petersen, found a solution to this problem. He found that declaring iGrid with the WithEvents modifier (see this post ) and setting the Enabled property through this strongly-typed object reference helps to solve the problem:

' Declare on form module level
Private WithEvents xGrid as iGrid

' Init xGrid var somewhere before use
Set xGrid = iGrid0.Object

' Disable iGrid properly
xGrid.Enabled = False


There is an explanation of this trick. When we write

iGrid0.Enabled = False


, actually we call the Enabled property provided by MS Access for all form controls, but this is not the Enabled property implemented in iGrid itself. MS Access does its own work to disable the control, but in the case of iGrid that has other nested API controls it has the described bad side effect.

The nature of this problem is the same as it is explained in this forum post:

GridlineColor not working in MS-Access 

Taking into account the above post, you can also use an equivalent 1-line solution to disable iGrid the right way:

iGrid0.Object.Enabled = False


However, note that the WithEvents trick described at the beginning of the post is a better way to solve this problem as it also allows you to avoid problems related to missing iGrid events.