Hans L


I am in a form which shows, i.a., an address and a billing address (in textboxes; record A). I skip down a few records (to record F), and the "skip" buttons (Previous, Next) have ThisForm.Refresh in them. So I figured that the textbox Value property would be updated. And the address textbox surely shows the correct address from record F.

But, when I click on a checkbox that moves the address to the billaddress textbox, I get the address from record A, not record F.

The InteractiveChange method of the checkbox has

"...txtBilladdr.Value = ...txtAddress.Value"

So, it seems as if "txAddress.Value" still holds the data from record A in spite of skipping down to record F, and Refreshing at every skip.

What am I missing (yes, the table is buffered)

Hans L



Re: Textbox value does not seem to change

Naomi Nosonovsky


I think I've seen similar problems, but my recollections are vague. Do you have a pageframe on the form

Try to use MyTable.MyField instead of the textboxes values and see, it this resolves the issue for now. Also is this object first in the tab sequence






Re: Textbox value does not seem to change

CetinBasoz

In checkbox try:

this.value = this.value first.






Re: Textbox value does not seem to change

Hans L

I do have a pageframe on the form, but I have taken that into account in "ThisForm...txtAddress.Value". Or any other reason for your question I'll get around it for now with MyTable.MyField, but ...

Hans L




Re: Textbox value does not seem to change

Naomi Nosonovsky

There are some issues with pageframes and refresh, that's why I asked this question. Are you calling somethere page refresh as opposite to thisform.refresh() If yes, try to call thisform.refresh instead. I had this problem and later with Walter Meester we determined it to be a bug in VFP9. I hope he reported it, I haven't checked.

I discussed this problem on for profit web-site, would not give you a direct link, sorry.





Re: Textbox value does not seem to change

Hans L

I found this on the net, plus some workarounds that I have not checked carefully yet.

"When the Refresh method of a pageframe is called, only the active page is refreshed; the rest of the pages are not refreshed."

But, I cannot tell you were I found it, because it may be a competing forum, and it would violate rules and regulations that no intelligent person can fathom. So all I can say is (and I am not even sure I can say this, so I will whisper): 'search on "refresh + pageframe" (shyyysh).

Hans L




Re: Textbox value does not seem to change

Hans L

Cetin, I did not understand what you meant with what you wrote. Would you kindly elaborate

Hans L




Re: Textbox value does not seem to change

Naomi Nosonovsky

Good tip for the search words, because I found it immediatelly too and even posted a message.

Anyway, good luck with the problem! At least you have a workaround now and also aware.





Re: Textbox value does not seem to change

CetinBasoz

In combo,listbox,checkbox like controls' interactivechange events you might need to do a 'force' of refreshing buffers first. You didn't give more details code wise so I simply thought it might be a reason. Unfortunately this is one of those hard to create a demonstration code situations but I have seen it and the solution was to do:

this.value = this.value

as the first line in event code.





Re: Textbox value does not seem to change

CetinBasoz

BTW I just noticed that you were talking about pageframes. Then the reliable pageframe refreshing is via setting activepage.

with myPageFrame

lnPage = .ActivePage

for ix =1 to .PageCount

.ActivePage = m.ix

.Pages[m.ix].Refresh

endfor

.ActivePage = m.lnPage

endwith

However instead of a loop you could also do that in UIEnable.





Re: Textbox value does not seem to change

Naomi Nosonovsky

In my opinion you don't need to refresh all pages, only the Active Page.

But anyway, I've seen the problem Hans described and we think it's VFP bug. Unfortunately, it's hard to create a reproducible test case.





Re: Textbox value does not seem to change

CetinBasoz

You may or may not. Depends.



Re: Textbox value does not seem to change

Hans L

You know, if I had known (but then, I would not have needed to ask :-) that the pageframe was the important aspect here, I would have told you that I was setting the Value of an object in the active page to the value of an object in a *non-active* page. So, I kinda have to refresh all pages when I do a Skip. I have done that with

LOCAL lnPage
FOR lnPage = 1 TO THISFORM.PgfParticipants.PageCount
THISFORM.PgfParticipants.Pages(lnPage).Refresh()
ENDFOR
THISFORM.Refresh()

which works fine (I have only four pages and a fast computer, but, of course, with a lot of objects and a slow computer, it might be better to just pick the value from the table in order not to slow down the refresh too much; I will probably go over to using Views mostly in later incarnations of this very rudimentary application, and I honestly don't know how to pick the value then, but I am sure it will be rather easy; as you understand, I am just at the beginning of my programming "carrier" :-)

I have taken note of the code snippets you provided, Cetin -- thanks.

Naomi, the fact that a "regular" Refresh only refreshes the active page is intentional according to the forum post that we both found.

Hans L





Re: Textbox value does not seem to change

Naomi Nosonovsky

Cetin, I just re-read your post, thanks a lot. I see, that you're saying that reliable way is to set the ActivePage first and then refresh.

Would keep this in mind in case I need to refresh all pages even non-active ones.

But on the other hand, Setting ActivePage would execute Activate method of that page. I often have code in it.

Luckily I hadn't a need to refresh non-active pages yet (or forgot about these cases).