Subject Re: [IBO] Bug in IB_Grid - OnExit firing
Author Geoff Worboys
Hi Paul,

> I am changing the size of a grid OnEnter and reverting back
> OnExit. If there is also something causing a layout change
> and the focused field has an IBMemoEnh then OnExit fires and
> the size reverts back although the grid still appears to have
> focus.

Does the problem not happen with any other type of control in
the grid?

If the problem happens with any control on the grid then...

There have always been complications with controls embedded in
a grid and focus detection. The reality is that focus has
moved out of the grid and into the IBMemo and back again. Some
of the code in ib_grid tries to ignore this distinction, but I
cannot remember what happens for grid OnExit, OnEnter.

If you look at TIB_CustomGrid.HasFocus you will see code that
can be used to detect whether the grid or any of its child
controls contains the focus or active control. (Regrettably
that method is private, so you cant use it directly you would
have to create your own copy.)

If the problem only happens with IBMemoEnh...

In this case I suspect the problem could be that the API handle
is being destroyed and recreated in order to alter certain
properties of the control. (eg: When resizing a memo with auto
scrollbars the control may decide that one or other scrollbar
is required and recreate itself to achieve the desired change.)

I have had various problems with automatic scrollbars on the
MemoEnh. In some situations I have found the best way to
achieve some level of stability is to fix the scrollbars as
needed (either as both with wrap=false, or at vertical with
wrap=true). This should stop the memo from making too many
API changes as it changes size.

I hope one of these helps.

Geoff Worboys
Telesis Computing