Strange Font Problem in fwh 1412

Re: Strange Font Problem in fwh 1412

Postby nageswaragunupudi » Wed Jan 28, 2015 1:31 pm

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  Expand view  RUN
CLASS TApp

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

 


Usage:
Code: Select all  Expand view  RUN

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
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Strange Font Problem in fwh 1412

Postby James Bott » Wed Jan 28, 2015 9:50 pm

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
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Strange Font Problem in fwh 1412

Postby nageswaragunupudi » Thu Jan 29, 2015 1:02 am

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
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Strange Font Problem in fwh 1412

Postby James Bott » Thu Jan 29, 2015 3:17 pm

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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 37 guests