FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Strange Font Problem in fwh 1412
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Strange Font Problem in fwh 1412
Posted: Wed Jan 28, 2015 01: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 ::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 (fw): Select all Collapse
CLASS TApp

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


Usage:
Code (fw): Select all Collapse
DEFINE DIALOG oDlg oApp:oFont
ACTIVATE DIALOG oDlg 
// You shoud not End oApp:oFont here
// oApp:End()    //Not correct. Excess destoyal


oApp:End() should be used only once at the end of the entire application.
Regards



G. N. Rao.

Hyderabad, India
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Strange Font Problem in fwh 1412
Posted: Wed Jan 28, 2015 09: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.

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Strange Font Problem in fwh 1412
Posted: Thu Jan 29, 2015 01: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
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Strange Font Problem in fwh 1412
Posted: Thu Jan 29, 2015 03: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
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion