A problem with SAY and font- style and < size default >

A problem with SAY and font- style and < size default >

Postby ukoenig » Tue Aug 13, 2019 2:08 pm

Hello,

I noticed a SAY painting problem and needed the following adjustment :

@ 26 * nFactor, 25 * nFactor SAY oDay PROMPT cDay OF oWnd FONT oFontDay PIXEL UPDATE
oDay:SetColor ( aVal[23], )
oDay:lTransparent := .T.
oDay:nLeft := ( oWnd:nWidth() - oDay:nWidth() ) / 2
oDay:nHeight += 5 // y display ( I think it will be the same with g and j
IF aVal[26] = .T. // Italic
oDay:nWidth += 8 // width itallic-font
ENDIF

Image
Last edited by ukoenig on Thu Aug 15, 2019 6:50 pm, edited 3 times in total.
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: A problem with SAY and font- style and size

Postby karinha » Thu Aug 15, 2019 1:08 pm

small sample?
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7835
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: A problem with SAY and font- style and size

Postby ukoenig » Thu Aug 15, 2019 3:45 pm

The same result creating a sample

the black titles and frames I got after the last Window 10 - update ( 2 days ago ) :(
All titles are black now word, exel ....
maybe possible to fix it :?:
I did a monitor-reset but no luck still the same
The black text changed to white now and the systembuttons are still painted black

Image

the normal view before the windows-update ( see the difference )
today I got another update but no change

Image

FUNCTION MAIN()
LOCAL oWnd, oTime, oDate, oDay
LOCAL oFontTime, oFontDate, oFontDay

cTime := SUBSTR( Time(), 1, 6) + "00"
dDate := Date()
cDay := cDow( Date() )

DEFINE FONT oTempTime NAME "Alpine" SIZE 0, -20
DEFINE FONT oTempDay NAME "Alpine" SIZE 0, -30
DEFINE FONT oTempDate NAME "Alpine" SIZE 0, -40

oFontTime := oTempTime:Modify( -30, .T., .T. )
oFontDay := oTempTime:Modify( -40, .T., .T. )
oFontDate := oTempTime:Modify( -50, .T., .T. )

// top, left TO height, width
DEFINE WINDOW oWnd FROM 100, 100 TO 400, 400 PIXEL ;
TITLE "ALARM" COLOR 0, 16777215

@ 30, 30 SAY oTime PROMPT cTime OF oWnd FONT oFontTime PIXEL UPDATE
oTime:SetColor ( 255, )
oTime:lTransparent := .T.
oTime:nHeight += 5
oTime:nWidth += 5 // Italic

oTime:nLeft := ( oWnd:nWidth() - oTime:nWidth() ) / 2 - 5 // centered

@ 80, 30 SAY oDay PROMPT cDay OF oWnd FONT oFontDay PIXEL UPDATE
oDay:SetColor ( 255, )
oDay:lTransparent := .T.
oDay:nHeight += 5
oDay:nWidth += 5

oDay:nLeft := ( oWnd:nWidth() - oDay:nWidth() ) / 2 - 5

@ 140, 30 SAY oDate PROMPT dDate OF oWnd FONT oFontDate PIXEL UPDATE
oDate:SetColor ( 255, )
oDate:lTransparent := .T.
oDate:nHeight += 5
oDate:nWidth += 5

oDate:nLeft := ( oWnd:nWidth() - oDate:nWidth() ) / 2 - 5
ACTIVATE WINDOW oWnd

RELEASE FONT oFontTime, oFontDay, oFontDate

RETURN NIL

The same without

oFontTime := oTempTime:Modify( -30, .T., .T. )
oFontDay := oTempTime:Modify( -40, .T., .T. )
oFontDate := oTempTime:Modify( -50, .T., .T. )


using

DEFINE FONT oFontTime NAME "Alpine" SIZE 0, -30 ITALIC
DEFINE FONT oFontDay NAME "Alpine" SIZE 0, -40 ITALIC
DEFINE FONT oFontDate NAME "Alpine" SIZE 0, -50 ITALIC

:Modify( is needed to change fonts at runtime

regards
Uwe :?:
Last edited by ukoenig on Thu Aug 15, 2019 4:53 pm, edited 1 time in total.
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: A problem with SAY and font- style and size

Postby karinha » Thu Aug 15, 2019 4:53 pm

Uwe, looks perfect. I did not find any errors. I did not understand.

Code: Select all  Expand view  RUN

#include "FiveWin.ch"

STATIC oWnd

FUNCTION Main()

   LOCAL oWnd, oTime, oDate, oDay
   LOCAL oFontTime, oFontDate, oFontDay, oTempTime, oTempDay, oTempDate
   LOCAL cTime, dDate, cDay

   // SET CENTURY ON
   SET DATE BRITISH
   SET TIME FORMAT TO "HH:MM:SS"
   // SET EPOCH TO YEAR( DATE() ) - 50

   // cTime := SUBSTR( Time(), 1, 6 ) + "00"  //???

   cTime := Time()
   dDate := Date()
   cDay := cDow( Date() )

   DEFINE FONT oTempTime NAME "Alpine" SIZE 0, - 20
   DEFINE FONT oTempDay  NAME "Alpine" SIZE 0, - 30
   DEFINE FONT oTempDate NAME "Alpine" SIZE 0, - 40

   oFontTime := oTempTime:Modify( - 30, .T. , .T. )
   oFontDay  := oTempTime:Modify( - 40, .T. , .T. )
   oFontDate := oTempTime:Modify( - 50, .T. , .T. )

   // top, left TO height, width
   DEFINE WINDOW oWnd FROM 100, 100 TO 400, 400 PIXEL ;
      TITLE "ALARM" COLOR 0, 16777215

   @ 30, 30 SAY oTime PROMPT cTime OF oWnd SIZE 120, 40 FONT oFontTime PIXEL UPDATE

   oTime:SetColor ( 255, )
   oTime:lTransparent := .T.
   oTime:nHeight += 5
   oTime:nWidth += 5 // Italic
   oTime:nLeft := ( oWnd:nWidth() - oTime:nWidth() ) / 2 - 5 // centered

   @ 80, 30 SAY oDay PROMPT cDay OF oWnd SIZE 198, 50 FONT oFontDay PIXEL UPDATE

   oDay:SetColor ( 255, )
   oDay:lTransparent := .T.
   oDay:nHeight += 5
   oDay:nWidth += 5
   oDay:nLeft := ( oWnd:nWidth() - oDay:nWidth() ) / 2 - 5

   @ 140, 30 SAY oDate PROMPT dDate OF oWnd SIZE 198, 50 FONT oFontDate PIXEL UPDATE ;


   oDate:SetColor ( 255, )
   oDate:lTransparent := .T.
   oDate:nHeight += 5
   oDate:nWidth += 5
   oDate:nLeft := ( oWnd:nWidth() - oDate:nWidth() ) / 2 - 5

   ACTIVATE WINDOW oWnd

   RELEASE FONT oFontTime, oFontDay, oFontDate

RETURN NIL
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7835
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: A problem with SAY and font- style and size

Postby ukoenig » Thu Aug 15, 2019 4:57 pm

Did You delete the marked lines for the width and height correction
to make the problem visible ?
You will see the difference without these lines and value -5

oTime:nHeight += 5
oTime:nWidth += 5 // Italic

oTime:nLeft := ( oWnd:nWidth() - oTime:nWidth() ) / 2 - 5 // centered

oDay:nHeight += 5
oDay:nWidth += 5

oDay:nLeft := ( oWnd:nWidth() - oDay:nWidth() ) / 2 - 5

oDate:nHeight += 5
oDate:nWidth += 5

oDate:nLeft := ( oWnd:nWidth() - oDate:nWidth() ) / 2 - 5

regards
Uwe :?:
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: A problem with SAY and font- style and size

Postby ukoenig » Thu Aug 15, 2019 5:30 pm

In Class TSAY I added

Line 93
// DEFAULT nWidth := SAY_CHARPIX_W * Len( ::cCaption ) - 4
DEFAULT nWidth := GetTextWidth( 0, ::cCaption, If( oFont != nil, oFont:hFont,;
If( oWnd:oFont != nil, oWnd:oFont:hFont,) ) ) + 5


because NO textwidth and height is defined ( DEFAULT-values )

should be corrected for a undefined nHeight as well

Line 72
nHeight := If( oFont != nil, Abs( oFont:nHeight ), SAY_CHARPIX_H ) + 5,;

regards
Uwe
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: No registered users and 55 guests