Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: ghosts and reload of form

$
0
0
Re: ghosts and reload of form
FoxInCloud
Re: ghosts and reload of form
04/10/2012
07:51:44 PM
3H516KODN Show this entire thread in new window
Gratar Image based on email address
From:
Tuvia Vinitsky
To:
Attachments:
None

Let me explain better. It is not specifically a FiC issue as in FiC code, but rather a browser issue that seems to be an unintended consequence.

1. A master page frmLogin is instantiated.
2. frmLogin calls a new master form frmTest.
3. On the frmtest is a button cmdExit that has a caption of 'Thierry.'
4. The cmdExit::click has thisform.release, which returns the user to the original master form frmLogin. The user does that.
5. A different user is now on frmLogin and calls frmTest.
6. frmtest.cmdExit::init sees the new user name and issues this.caption = 'Christophe'
7. The users sees frmtest with the button saying Christophe. However for a brief second when the form loaded, they saw the button say Thierry.
8. In a real form with only 1 control, that brief second is very, very short and probably not long enough for the user to "see".

So let's fix it:
1. Set frmtest.cmdButton.caption = ''
2. Move init code from control to form.
3. No help.

So let's really fix it:
1. Set frmtest.cmdButton.caption = ''
2. Move init code from control to form.
3. Have init code check a passed parameter (passed to the form) to see what the caption should be. Set the caption.
4. Still no help.

So let's really really fix it:
1. Set frmtest.cmdButton.caption = ''
2. Move init code from control to form.
3. Have init code check a passed parameter (passed to the form) to see what the caption should be. Set the caption.
4. Bracket caption changing code with "if pcount() > 0" so only fires when we want and so gen process does not set the caption by firing our code during generation (that would be bad).
5. Fixed. No more ghost cached image.

So because there is no Load method firing before the form appears, our button's capton must:
a. be blank
b. not be changed during HTML generation (bracketed with pcount seems easiest way)
c. set during form init via a passed parameter

Now why is this not usually a problem? because a form with a few simple controls renders so fast that the naked eye sees a blink but does not recognize the old display.

Now add a grid with 30 columns, 10 buttons, and 10 images. In the grid for example, you will literally see for 0.5 seconds the data from the previous time the form was displayed, until the init process for each control is finished.
THAT is a problem.

Based on what we have done so far, the only way to counter that effect is to set all controls to blank and set every property during the form init. You completely lose the ability to design any properties via the VFP visual tools, and end up writing many lines of code to do everything in the form init (based on some parameters).

Lockscreen will not help; it is the browser which is attempting to render the latest instance of the page. FiC is not asking it to do that. Thus is the FiC rendering is fast enough or there are few controls, no problem. otherwise the browser displays the last cached image -- which now has to be all empty controls which we set thru the form init.

Since VFP has Load and re-instantiates a new form upon request, the issue is only web based and not in LAN mode.

Hope this makes sense.



Tuvia,
HTML is generated when form is first instantiated, without any parameter provided to .init()

I don't understand what you mean by 'ghost'; what I could understand is:
What do you have in generated HTML?
What do you get in Server response when form shows up in browser? (InitControlsInet)



The issue is worse than I thought.

As a side not, the picture property problem was related to this: This original code did not work:

proc init lparameters tParam1 dodefault() WITH THIS AS awFrm OF aw.vcx .xxx = xxx . . . . . . ....... .lockscreen=.t. if pcount() > 0

But it did work when I changed it to the

proc init lparameters tParam1 dodefault() if not thisform.wlhtmlgen with thisform .xxx = xxx . . . . . . ....... .lockscreen=.t. if pcount() > 0


But now I have to deal with ghosting on every other control . That means I now have to manually set in the init every single grid property, every button caption, etc., or it shows as a ghost. what can we do about this? It seems like a pretty big issue for multi-user multi-dataset. It is also a security issue. Rewrtiting every form to never instatitate any properties of any controls except in the .init is not practical.


Why is code in .init being executed during generation if wlhtmlgen = .f.? In this code, should testme() fire?

proc init dodefault() && fires FiC default, should be first thing in init per FiC if not thisform.wlHTMLgen testme() endif


Yes, and I regened just now I see sometimes I get an unexpected "src=Images/" with no file. I am checking into how this is occurring . . . .


just to be sure,
what do you have in src attribute (<img src="?" />), in generated HTML?

That is how I started out. It does not help. before leaving the form I also set the .picture back to ''. I can have NO picture and will still see the previous instance's image/picture.

The problem is systemic. The HTML from the last time the form appeared always flashes initially. In fact even if you do not see it, record the screen display and play it back slowly and you will see it. If the form has enough controls the image stays long enough to be more clearly visible.

It seems to be a caching problem. I can see it in FF 11.0 and IE8 for sure, have not tried other browsers. I have the browser set to always check the page rather than use the cached page. Not sure yet how to gtet around this.



I would suggest to have .Picture = '' when form loads, then assign .Picture in form.init() based on a parameter
This way HTML is generated with no image in control
HTH,

Since forms are really only instatiated once, I have the following problem: on a form I have a logo xxx.jpg. That logo is related to user XXX. Now the user presses the "exit" button, which closes this page and brings him to the home login page. Now user YYY logs in. We "instantiate" the form for him and change the logo to be yyy.jpg.

No matter what, there is always a brief ghost image of the previous logo. No combination of lockscreen or of even resetting the picture property on "exit" helps, not to mention that the user may just use the back button to get back to the login screen and never touch our exit button. I tried code in:

logo init
form init
last method called before form release

and I cannot get rid of the 1 second ghost image.

I experimented with some other forms as tests, and I found that this is pervasive, but if the form hs few enough controls to paint, the ghost can be short enough not to be very noticeable.

The problem is not just images, since the form has to re-init, there is always a delay. Just so happens in my case, with many controls, the ghost is bad, but I only happen to care now about the image control.

Any suggestions appreciated.









Viewing all articles
Browse latest Browse all 10393

Trending Articles