Subject RE: [IBO] Trouble with TDateTimeEnh
Author Paul Hope
Hi Geoff

> > It appears to a random timing thing. I can click the drop
> down button
> > then click a date and the chances of it giving the error
> seem to about
> > 50-50.
>
> Can you pick a difference in the call stack if you put in a
> break in the code (at the SetFocus call if you can).
>
> We need to work out the timing of the closeevent call, to see
> how it is that the controller has managed to get to be
> invisible before the call completes. If you can get the
> callstacks from a successful run and a failed run then
> perhaps I can try and make sense of it. (I dont do much
> grid-based editing here, so have nothing to experiment with myself.)
>

The call stacks are identical and only contained two very obvious entries -
didn't look much help.


> It also occurs to me that there may be a call to
> Application.ProcessMessages happening within the Change or
> CloseUp function calls. If you can use the debug delphi libs
> and break in the processmessages call we may see who is doing
> it and if there is a way around it.
>

I do have Application.ProcessMessages running and I was using a derivitive
of TIB_Grid which has some message posting going on. So I just created a
demo app with just a grid and a TIB_DateTimeEnh. It doesn't fail with the
error but it does lose the focus after closeup (or editing) although it then
reappears on tab in the next cell.


> If all else fails you could stick in some code that tests
> whether the controller's parent is based on TIB_CustomGrid
> and if so, and controller is not visible, focus the grid
> instead. That might work, even if ugly.

The controllers parent wasnt the grid but the parent.parent was in the main
app giving the problems - in the demo the parent is the grid.

I suppose the first thing is to get the standard grid and editor to work.

This is my basic test

I have a grid with 3 columns, the middle one being a date and having the
TIB_DateTimeEnh.
Tab into the first column it is has the focus box around it,
tab into the second column and the TIB_DateTimeEnh is in edit mode with the
whole date highlighted and the carret at the right hand end, the combo
button has appeared
Hit arrow right to take off the highlight and back space over the year and
change it
Tab and the 3rd column cell goes blue with white text **
Tab again the 3rd column cell has the focus box

The line marked ** shouldn't happen.

I know this isnt the original problem but it may help to solve that problem
by getting a better handle on where the focus goes.

?

Regards
Paul