Page 1 of 1

write a test on Image control

PostPosted: Mon Feb 13, 2023 5:21 pm
by Silvio.Falconi
I have an image control with ximage ( no bitmap no btnbmp)

Code: Select all  Expand view

 @  240,  90 XIMAGE oImage ;
             FILENAME ".\bitmaps\verde.jpg"  NOBORDER ;
             SIZE 250,200 ;
             OF oFrmFiscale ;
             UPDATE
            oImage:bRClicked  := { || NIL  }
            oImage:ltransparent:=.t.
            oImage:nUserControl :=0
 


and I try to write a text into

Code: Select all  Expand view
Static Function Calcola()
 local oBold
          DEFINE FONT oBold NAME 'Tahoma' SIZE 0, -16  BOLD
////my calculation
cCod :="wwwwwwwwwwwww"

 oImage:bPainted:= { |hDC|myfunc(hdc,oBold,cCod)}


return  nil

 Function  myfunc(hdc,oBold,cCod)
           FW_SayText( hDC, ;
           cCod, ;
          { 150, 32, 108, 25 },,oBold, CLR_GREEN,  , .f. )

       return nil



why not run ?

Re: write a test on Image control

PostPosted: Mon Feb 13, 2023 9:59 pm
by cmsoft
Silvio, creo que el rectangulo de coordenadas donde muestras el texto tendría que ser mas grande
Code: Select all  Expand view

Function  myfunc(hdc,oBold,cCod)
           FW_SayText( hDC, ;
           cCod, ;
          {150,32,170, 250 },,oBold, CLR_GREEN,  , .f. )  // x1,y1 hasta x2,y2
return nil
 

Re: write a test on Image control

PostPosted: Mon Feb 13, 2023 10:19 pm
by Silvio.Falconi
cmsoft wrote:Silvio, creo que el rectangulo de coordenadas donde muestras el texto tendría que ser mas grande
Code: Select all  Expand view

Function  myfunc(hdc,oBold,cCod)
           FW_SayText( hDC, ;
           cCod, ;
          {150,32,170, 250 },,oBold, CLR_GREEN,  , .f. )  // x1,y1 hasta x2,y2
return nil
 


only if i hover over it then i see something, the procedure has some gets that the user has to fill in, every time i fill a get i refresh ccod . back in the day i used a say control on the dialog and did oSay:setext(ccod ) now I wanted to insert the string above an image

if I use btnbmp I have no problems and the function correctly writes cCod but if I use ximage I don't see the writing printed on the image

Re: write a test on Image control

PostPosted: Mon Feb 13, 2023 10:28 pm
by Silvio.Falconi
resolved
need oImage:refresh()

Re: write a test on Image control

PostPosted: Mon Feb 13, 2023 11:46 pm
by cmsoft
Me alegro Silvio!