Page 1 of 1

FW_SayText problem

Posted: Tue Dec 18, 2018 9:50 am
by Silvio.Falconi
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

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

Re: FW_SayText problem

Posted: Tue Dec 18, 2018 1:05 pm
by karinha
Look in PRINTER.PRG,

Code: Select all | Expand


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
 

Re: FW_SayText problem

Posted: Tue Dec 18, 2018 1:09 pm
by karinha

Re: FW_SayText problem

Posted: Tue Dec 18, 2018 1:24 pm
by Silvio.Falconi
opps