Vlad,
I tried using LostFocus(), but it doesn't always fire. The only solution I found is to keep track of GotFocus and LostFocus. Add a property ilOleBoundGotFocus to the form and add the following code:
IF UPPER(ThisForm.ActiveControl.name) = "OLEBOUNDCONTROL1" OR ThisForm.ilOleBoundGotFocus
ThisForm.ilOleBoundGotFocus = .f.
ThisForm.Refresh()
ENDIF
ThisForm.ilOleBoundGotFocus=.t.
ThisForm.ilOleBoundGotFocus=.f.
ThisForm.Refresh()
Not pretty, but it seems to work :)
>Thanks, this indeed a step further!
>
>Any way to catch the moment when user finish to edit the Excel document? From what I see in the events log, only Pint() event of the form and screen is called. Sometimes also screen.resize() is called, but it is not reliable.
>
>>Vlad,
>>What version of VFP do you have? I don't see this behaviour. The only thing I noticed is that after editing the Excel sheet, I need to call OLEBoundControl.Refresh(), otherwise it displays some weird stuff. This happens both in VFP6 SP5 and VFP7.
>>
>>>Hi!
>>>
>>>When displaying Sheet either in OLE Bound Control or in the window for General field editing, Excel sheet tries to display all columns at once. This cause it resized inside of the OLE Bound Control box by such way that all cells appear as a very little rectangles and no way to see something in cells. Changing of values of properties OLEBoundControl.Sizable, OLEBoundControl.Stretch, OLEBoundControl.AutoSize, OLEBoundControl.Object.Windows(1).EnableResize did not helped at all.
>>>
>>>Does anybody know what to do to display Excel sheet in the OLEBoundControl correctly so it is not resized to the bounds of the OLE control?
>>>
>>>Thanks in advance!
Daniel