Hi Francisco,
Yes this was a real pain in the rump back in VFP 5.0 and it was hard to reproduce if you didnt know exactly what to do.
The behavior occurs when you are on a control and you click on a part of the page object that is not covered by a control. When you do this, the control appears to have updated its controlsource but if you click back on the control, you will notice that the value reverts back. It is the equivalent effect of clicking on a toolbar - the lose focus doesnt fire and the controlsource does not get updated.
The problem occurs whether the control is on a page frame or not.
The simple answer is that your pages need underwear < g >. If you put a barrier between the page and the mouse, clicking on the barrier causes the control to lose focus properly and update the controlsource.
The quick solution is to add a line object to the page of the pageframe, stretch the line to the dimension of the page. You could put the following into the init of the pageframe:
WITH this.page1
.AddObject("oUnderwear","line")
WITH .oUnderwear
.Top = 0
.Left = 0
.Width = this.PageWidth
.Height = this.PageHeight
.Visible=.t.
.BorderStyle = 0
.Zorder(1)
ENDWITH
ENDWITH
I have uploaded a file called pgfbug.zip in the Visual Foxpro in General section of the files area of the UT. It demonstrates the problem and shows a solution. Also included is a pageframe class (in barrier.zip) that automatically adds the lines to the pages of pageframes and even checks in the refresh to make sure that all pages have a barrier, and if any dont (because of dynamic adding of pages for instance) it adds them to the page.
Hope this helps,
Rick
>I have a textbox in a page of a pageframe with the controlsource property pointing to a field in a table.
>
>I key in a value in the textbox and then click somewhere in the page (not in another control but in a free space of the page)
>
>The textbox lost the focus but the controlsource wasn't updated.
>
>This behaviour doesn't happen in VFP6. It only happens in VFP5.
>
>Anyone know a workaround ?