FW_SayText problem

FW_SayText problem

Postby Silvio.Falconi » Tue Dec 18, 2018 9:50 am

I must make a button (btnbmp) as this

Image

I tried to draw it
But I have problems I not understood why not write the text

Image

I made
Code: Select all  Expand view
function Test()

   local oDlg, oBtn, oBold, oFont
   local nRow, nCol, n
   local cPrice:="€5.00"
   Local cDesc:="OMBRELLONE"
   Local fromdate :=date()
   Local todate  :=date()
   Local nOmbrellone:= 13
   Local ggiorni:= 1

   DEFINE FONT oBold NAME "TAHOMA" SIZE 0,-14 BOLD
   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-12

   DEFINE DIALOG oDlg SIZE 700,400 PIXEL TRUEPIXEL FONT oFont

   nRow  := 20
   nCol  := 20
 @ nRow,nCol BTNBMP oBtn ;
         PROMPT cDesc + CRLF+  CRLF+;
         SPACE(20)+ dtoc(fromdate)+ CRLF +;
         SPACE(20)+ dtoc(todate)  ;
         SIZE 550, 100 PIXEL OF oDlg FLAT RIGHT     ;
         TOOLTIP "fai click per aggiungere un servizio" ;
         COLOR CLR_CYAN,CLR_WHITE

 oBtn:bPainted   := { |hDC| FW_DrawImage( hDC, "ombrellone.bmp", { 2, 1, 124, 62 } ), ;
                                 FW_SayText( hDC, oBtn, { 67, 61, 54, 75 },str(nOmbrellone),oBold, CLR_HRED, nARGB(255,CLR_YELLOW), .t. ),;
                                 FW_SayText( hDC, oBtn, { 117, 71, 74, 95 },cPrice,oBold, CLR_HRED, nARGB(255,CLR_YELLOW), .t. )}

 oBtn:oFontBold    := oBold   // <-- NOTE  RGB( 225, 225, 225 )
      oBtn:nClrBorder := { || (IIF(oBtn:lMOver,CLR_BLUE,CLR_RED)) }
      oBtn:bClrGrad = { | lInvert | If( ! lInvert,;
                    { { 1, CLR_WHITE, CLR_WHITE } },;
                    { { 1, RGB( 229,241,251 ), RGB( 229,241,251 ) } } ) }

      oBtn:SetThemed(.T.)   // ???????



   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont, oBold

return nil
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6897
Joined: Thu Oct 18, 2012 7:17 pm

Re: FW_SayText problem

Postby karinha » Tue Dec 18, 2018 1:05 pm

Look in PRINTER.PRG,

Code: Select all  Expand view

METHOD SayText( nRow, nCol, cText, nWidth, nHeight, oFont, cAlign, nClrText, nClrBack, cUnits ) CLASS TPrinter

   local aRect, nRet

   DEFAULT cUnits := "PIXEL"

   ::Units2Pix( @nRow, @nCol, @nWidth, @nHeight, cUnits )

   DEFAULT nWidth    := 0.9 * ::nHorzRes() - nCol
   DEFAULT nHeight   := 0.9 * ::nvertRes() - nRow
   DEFAULT cAlign    := "LT", nClrText := CLR_BLACK

   aRect       := { nRow, nCol, nRow + nHeight, nCol + nWidth }

   /*
   // fwh 16.05. Omitted so that this conversion is left to FW_SayText() function

   // Era assim na versao fwhx1608: Joao
   // fwh 16.05. Omitted so that this conversion is left to WndSayText() function
   if ValType( cText := XEval( cText ) ) != 'C'
      cText    := cValToChar( cText )
   endif
   */


   IF FWVERSION = "FWHX 16.08"

      // nRet  := WndSayText( ::hDCOut, cText, aRect, cAlign, oFont, { nClrText, nClrBack } )

   ELSE // FWH16.12

      nRet  := FW_SayText( ::hDCOut, cText, aRect, cAlign, oFont, nClrText, nClrBack )

   ENDIF

   if Empty( nRet )
      nRet  := nRow
   endif

   ::Pix2Units( @nRet, nil, nil, nil, cUnits )

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

Re: FW_SayText problem

Postby karinha » Tue Dec 18, 2018 1:09 pm

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

Re: FW_SayText problem

Postby Silvio.Falconi » Tue Dec 18, 2018 1:24 pm

opps
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6897
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

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