Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP9 SP1: trouble with embossed form look

Status
Not open for further replies.

Eliott

Programmer
Nov 8, 2009
91
0
0
BA
Hi there,
My friend visited me today and asked me to demonstrate the capabilities and ease of use VFP. He normally uses other more expensive tools for the development of the DB application and wanted to know how hard it is to work with VFP. When I showed him the forms wizard, I chose Embossed style and form appeared after a few seconds, with all elements of the free table aimed for test purpose. But when I started and began to navigate form by clicking the Next or Prev buttons text labels on form started to change (class Embossedlabel)! More specifically, with each new click on the Next or Prev button text labels went a little blurrier, fattier, almost hard to read! VFP9 SP1 is installed on MS Win XP SP2. Then I installed VFP to another PC in order to check eventually damage of vcx class. Same thing (PC under MS Win 7)! Until now I have not noticed this problem when used Embossed shape. I was searching on the Internet but did not find an indication of a similar occurrence. Does anyone have an idea what this is? Thanks in advance for your reply.

There is no good nor evil, just decisions and consequences.
 
@mgagnon: sorry, I didn't understand you, you mean that such "feature" doesn't appear with VFP9 & SP2 on Windows 7? Right?

There is no good nor evil, just decisions and consequences.
 
At least that is a benchmark, VFP9 SP2 and Win7.

To the problem itself there indeed is a glitch with how label captions are redrawn, when a refresh is needed. Not all pixels are rewritten exactly like initially and some are not overdrawn, so that results in a bad look at edges.

You can fix it by introducing a short routine in the Refresh() method, which sets the caption to "" and then back to it's value, as that erases the previous caption.

Of course it's best to do that in a low level base class once, if you have used the baseclass label you have much work to do now to fix that or live with it.

Bye, Olaf.
 
Actually I must have forgotten a detail of the fix, but I hve implemented it somewhere, that has to wait until monday.

I can reproduce with a form wizard created form based on the free table foxcode.dbf and the embossed style and the fix of resetting the caption did not work out.

Bye, Olaf.
 
Hi,

First of all the wizzards are not everybody's favourites.
The sympton you describe normaly shows when you have themes on. Try the same form with themes off.

Jockey(2)
 
This bug has nothing to do with the wizards, it's a bug of how labels are drawn.

Turning Themes off doesn't change anything.

This sample should be a repro, simply resize the form and see how the look of the labels changes.

"Works" for XP, Vista, Win7 with VFP since it draws via gdiplus, that should be since VFP7. It's a rather old bug, but does not happen in any circumstance.

Code:
o = createobject("labelbugform")
o.Show(1)

DEFINE CLASS labelbugform AS form

	Top = 0
	Left = 0
	Height = 77
	Width = 154
	ScrollBars = 3
	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"

	ADD OBJECT label1 AS label WITH ;
		FontSize = 8, ;
		BackStyle = 0, ;
		Caption = "Label1", ;
		Height = 14, ;
		Left = 24, ;
		Top = 24, ;
		Width = 48, ;
		Name = "Label1"

	ADD OBJECT label2 AS label WITH ;
		FontSize = 8, ;
		BackStyle = 0, ;
		Caption = "Label1", ;
		Height = 14, ;
		Left = 12, ;
		Top = 48, ;
		Width = 48, ;
		Name = "Label2"


	ADD OBJECT label3 AS label WITH ;
		FontSize = 8, ;
		BackStyle = 0, ;
		Caption = "Label1", ;
		Height = 14, ;
		Left = 108, ;
		Top = 48, ;
		Width = 48, ;
		Name = "Label3"


	ADD OBJECT label4 AS label WITH ;
		FontSize = 8, ;
		BackStyle = 0, ;
		Caption = "Label1", ;
		Height = 14, ;
		Left = 72, ;
		Top = 96, ;
		Width = 48, ;
		Name = "Label4"

ENDDEFINE

Bye, Olaf.
 
Olaf,

Interesting. Behavior cfmd. However if I change and instantiate exactly the same form as in your example now visualy the effect works only on fontsize 8, with fontsize 9 and 10 nothing happens.
This was VFP9SP2 -Win7-64


Regards,

Jockey(2)
 
I simply did copy the properties of the embossedlabel class, it's fontsize 8. But the effect is not limited to that fontsize, I've also seen it on other fonts and fontsizes in an app. As promised, tomorrow on monday I can lookup a solution,

Bye, Olaf.
 
Olaf

This for me (VFP9 SP2 windows 7) does not chow this bug (Removed the backstyle)
Code:
o = createobject("labelbugform")
o.Show(1)

DEFINE CLASS labelbugform AS form

    Top = 0
    Left = 0
    Height = 77
    Width = 154
    ScrollBars = 3
    DoCreate = .T.
    Caption = "Form1"
    Name = "Form1"

    ADD OBJECT label1 AS label WITH ;
        FontSize = 8, ;
        Caption = "Label1", ;
        Height = 14, ;
        Left = 24, ;
        Top = 24, ;
        Width = 48, ;
        Name = "Label1"

    ADD OBJECT label2 AS label WITH ;
        FontSize = 8, ;
        Caption = "Label1", ;
        Height = 14, ;
        Left = 12, ;
        Top = 48, ;
        Width = 48, ;
        Name = "Label2"


    ADD OBJECT label3 AS label WITH ;
        FontSize = 8, ;
        Caption = "Label1", ;
        Height = 14, ;
        Left = 108, ;
        Top = 48, ;
        Width = 48, ;
        Name = "Label3"


    ADD OBJECT label4 AS label WITH ;
        FontSize = 8, ;
        Caption = "Label1", ;
        Height = 14, ;
        Left = 72, ;
        Top = 96, ;
        Width = 48, ;
        Name = "Label4"

ENDDEFINE

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
ReFox XI (www.mcrgsoftware.com)
 
Actually the fix I use is:

Code:
Local lcCaption
lcCaption = This.Caption
This.Caption = ""
This.Caption = lcCaption

1. The bug does not show on XP for me
2. The fix is not working in my Tests on Vista (so that's bad news)
3. Removing BAckstyle means opaque backstyle, which you most often would not want on themed forms, where at least in Vista/Win7 you have a slight color gradient, which is broken by an opaque label look.

Surely the transparent style adds to the problem or even is the source of the problem, but I'd surely like a solution working with transparent backstyle.

What would perhaps help is implementing something redrawing captions in Form.Draw and Form.Paint.

Bye, Olaf.
 
Thisform.Cls() in Resize() works for me with transparent labels.

Bye, Olaf.
 
Hi pals,
thank you for your inputs and sorry for my delays with answer. I tried some of offered solutions and thanks to Olaf's presumption I discovered that problem doesn't appear if I change label Backstyle from Transparency to Opaque, but then I must to do it for all labels on such forms and change color of label backgrounds to match background of form;
I put finally
Code:
Thisform.Cls
in Paint method of the form and it seems like working solution. Please try it and let me I'm I in right. Thanks again to all for your contribution to solve this problem.

There is no good nor evil, just decisions and consequences.
 
In Paint you should be cautious, if you read the help on that event and/or on Draw you see you should not trigger new Paint/Draw events, this can lead to infinite recursion.

If it works, okay.

Bye, Olaf.
 
I can confirm Thisform.Cls() in the Paint event works as a fix for transparent labels, and doesn't cause an inverse recursion loop for me and that simple test form.

Bye, Olaf.
 
Hello Carlos,

Ah yes, this is a good explanation. Then cls() is working, because it's resetting the background.

Bye, Olaf.
 
thisform.cls is good thing as short-term solution for described problem but if you use on same form object Timer - then think twice.

There is no good nor evil, just decisions and consequences.
 
What do you mean by this? A Timer doing a form.resize()?
Look into my post, I put the cls in Resize only.
Cls is only needed when resizing or when a form is redrawn because of another form moving in front. Not necessarily in each refresh().

You could also turn cleartype off, as that is the source of the problem.

Bye, Olaf.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top