Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Repaint a form?
Message
From
25/04/2019 07:00:13
 
 
To
25/04/2019 05:58:36
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01668268
Message ID:
01668281
Views:
57
Likes (1)
>>>Can I re-display the content of a form?
>>
>>There are two separate methods for two different purposes:
>>
>>THISFORM.Draw() && Repaints the form controls. For instance you are in a loop and you update a label caption.
>>Without the Draw() in the example you won't see any of the changes in the label caption until the method finishes. Similar when you create, re-position or change any other layout properties of visible controls.
>>
>>FOR lnNr = 1 TO 100
>>    THISFORM.lbl.Caption = "Text " + TRANSFORM(m.lnNr)
>>    … do some processing...
>>    THISFORM.Draw()
>>ENDFOR
>>
>>
>>THISFORM.Refresh() && To update display value in controls that are bound to fields or variables using controlsource.
>>Without the Refresh() in the example you won't see the replaced value in Customer.Firstname.
>>
>>THISFORM.txt.ControlSource = "Customer.Firstname"
>>REPLACE Firstname WITH "Test" IN Customer
>>THISFORM.Refresh()
>>&& or selectivly:
>>THISFORM.txt.Refresh()
>>
>>
>>Very often Refresh() is being used where Draw() was actually meant. But Refresh() has no other effect except updating changed values in controlsources. So in the first example, THISFORM.Refresh() would not be correct.
>
>Christian,
>are you shure that "Thisform.Refresh" only updates the values in controlsources? I do believe it will also 'repaint' the images on your from. "ThisForm.Draw" will repaint your images, but will not update the controlsource. So if you 'draw' and still have unupdated controlsources you will still see the old pictures, I believe.
>
>Regards,
>
>Koen

Now I found the differences: Refresh() updates properties differently depending on the baseclass. For instance the label control updates the caption, but not other properties. I had forms where a logging output was on a label, which was made visible at the beginning of the procedure. During running of the procedure the changing text was not visible, because the label got visible after the process was finalized. In that case you need to draw() Right after making the contol visible.

Other controls work differently, a shape would be redrawn with Refresh(), and I suppose an Image would redraw the picture.

That was the reason I now use Draw() for the visual properties and Refresh() for controlsources, because Refresh() handles controls differently.
Christian Isberner
Software Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform