Strange Font Problem in fwh 1412

User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Strange Font Problem in fwh 1412

Post by nageswaragunupudi »

Horizon wrote:Hi Antonio,

I think I have found one more problem in my app.

I use oFont variable from app. main in my class. But I always ::oFont:End() it.

::oFont := oFont

I think its not the correct syntax. How can I clone ::oFont variable from oFont?

Thanks.
If your code and usage is something similar to this it is ok:

Code: Select all

CLASS TApp

DATA oFont
....
METHOD New(...) TApp
....
DEFINE FONT ::oFont NAME .....

 
Usage:

Code: Select all

DEFINE DIALOG oDlg oApp:oFont
ACTIVATE DIALOG oDlg 
// You shoud not End oApp:oFont here
// oApp:oFont:End()    //Not correct. Excess destoyal
 
oApp:oFont:End() should be used only once at the end of the entire application.
Regards

G. N. Rao.
Hyderabad, India
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: Strange Font Problem in fwh 1412

Post by James Bott »

Hajan,

When a font suddenly changes to the system font it usually means you are running out of memory. It seems you are not ending all the fonts created.

If you want to use an app standard font why not just use a function.

Function StandardFont()
return TFont():New( "Verdana", 0, -12)

The to create a new copy of the font:

local oFont:= StandardFont()

...do whatever

// don't forget to end it
oFont:end()

By using a function to create your standard font you can later change the standard font by only making a change to the StandardFont() function.

Or, you can use Nages' method of creating an app class containing a font and just keep reusing it.
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Strange Font Problem in fwh 1412

Post by nageswaragunupudi »

When a font suddenly changes to the system font it usually means you are running out of memory. It seems you are not ending all the fonts created.
It is the opposite.

This happens when a Font object is Ended while still in use by some controls / Ended more times than created/Set.

Also happens when a Font is released after ACTIVATE statement of a non-modal dialog or a window which is not the main window like mdichild.
Regards

G. N. Rao.
Hyderabad, India
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: Strange Font Problem in fwh 1412

Post by James Bott »

Nages,
It is the opposite.
I stand corrected. I was very sleep deprived yesterday. I was thinking of bitmaps that become strange when memory is low.

James
Post Reply