How to show changed Propertys of a Font at Runtime ?

How to show changed Propertys of a Font at Runtime ?

Postby ukoenig » Tue Oct 06, 2009 9:40 pm

Hello,

is it possible, to change the Propertys of a defined Font at Runtime ?
I want to change the Font-Size with a Slider and show the Result of the changed Font.
I used : oTextFont:nWeight := nNewWeight, oGet:Refresh()
but it doesn't work for the Get-Field, only in a new opend Preview-Dialog.
Bold and Italic are defined from the Fontmanager.
Once a Font is selected, I don't want to load the Fontmanager again for a Font-Size-Change.

Image

I can change the Propertys with the Sliders, but the Result is shown only
inside the new opened Preview-Dialog.
I would prefer to see a straight Result of the Change in the Main-Folder-Page.

Image

The VTitle-Tool is nearly finished and will save a lot of Time, spending with testing for a good Result.
All Values of a VTitle can be changed with any Combination and displayed on a selected Background.
Up to 10 BMP's can be placed inside the VTitle on defined Positions with any Setting ( Reflex, Animated .... )
It is possible, to save all selected Settings to a Project-Database.
A Set can be loaded, modified and saved as a new Project-Record.

Define up to 10 BMP's with
Reflex, Animated, Size, Transparent-Level ...

Image

... and place them inside the VTitle

Image

Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: How to show changed Propertys of a Font at Runtime ?

Postby Antonio Linares » Sat Oct 17, 2009 5:28 pm

Uwe,

As far as I know there is no way to dinamically change the properties of a FONT as it uses a handle (HFONT) to the created one, which it is a Windows own GDI object.

You may have to destroy the previous handle of the font, using DeleteObject() and then create a new font using CreateFont()

http://msdn.microsoft.com/en-us/library/dd183499(VS.85).aspx
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41324
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: How to show changed Propertys of a Font at Runtime ?

Postby ukoenig » Wed Oct 21, 2009 12:46 pm

Antonio,

the Screenshot shows, what I'm trying to do :
Each Browse-Record includes the Var's of a Project ( and different Fonts )
Changing the Record-Position, I want to show the used Font-Style with a SAY.
The SAY shows only the Font from the 1. Record at Start.
Maybe still another Solution to show the used Font ?

Image

Code: Select all  Expand view

STATIC FUNCTION Project()
LOCAL oDlg, oSAY1, oBtn70, oLbx70, oLbx71

// The Font-SAY creates a Font from DBF-values
cSAY1 := "TestFont"
oShowFont := TFont():New( aFTYPE[1],aFTYPE[2],aFTYPE[3],.F.,aFTYPE[4],aFTYPE[5],0,0,aFTYPE[6] )

DEFINE DIALOG oDlg RESOURCE "Project"  TRANSPARENT ;
TITLE  "Project-Edit" FONT oProgFont

...
...
oLbx70:bLClicked := { | nRow, nCol | LOAD_DATA(), ; // New Font-Infos from DBF-Record
   DeleteObject(oShowFont), ; // Delete the old Font
   NEW_ARRAY(), oLbx71:Refresh(), ;
   oShowFont := TFont():New( aFTYPE[1],aFTYPE[2],aFTYPE[3],.F.,aFTYPE[4],aFTYPE[5],0,0,aFTYPE[6] ), ;
   oProject:Refresh(), oTitle:Refresh(), oSay1:Refresh() } 

...
...
REDEFINE SAY oSay1 VAR cSAY1  ID 150  OF oDlg FONT oShowFont  UPDATE
oSAY1:lTransparent := .T.
...

// ------ Loads the Values of a Font from the Project-DBF -------------------

FUNCTION LOAD_DATA()
...
...
...
aFTYPE[1]      :=  ALLTRIM((1)->DFTYPE1) // Font-Name
aFTYPE[2]      :=  (1)->DFTYPE2 // Weight
aFTYPE[3]      :=  (1)->DFTYPE3 // Height
aFTYPE[4]      :=  (1)->DFTYPE4 // Bold
aFTYPE[5]      :=  (1)->DFTYPE5 // Horizontal / Vertical
aFTYPE[6]      :=  (1)->DFTYPE6 // Italic

TEXTFONT :=  (1)->DTEXTFONT // Fontstring
...
...

RETURN NIL  
 


Instead using a SAY, I added a small VTitle for the Font-Preview on Dialog-Bottom,
that works showing the real Font on Record-Change with a used Shadow, Brush or Color.

Image

Maybe the only Solution for it ?

Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

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