FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour para Antonio : Sobre BTNBMP... oBtn:bPainted (RESUELTO)
Posts: 400
Joined: Tue Oct 16, 2007 05:51 PM
para Antonio : Sobre BTNBMP... oBtn:bPainted (RESUELTO)
Posted: Wed Jun 04, 2014 04:26 PM
Buenos dias,

No se si se pueda hacer lo siguiente :

Tengo la necesidad de identificar unos botones para el usuario, como muestro en la imagen,
exactamente es el texto que esta encerrado en color rojo, usando el comando REDEFINE BTNBMP ....,

http://www.4shared.com/photo/tfYyv9Xmba/Botones.html?
" alt="" loading="lazy">

Gracias,

Saludos Cordiales,

Albeiro.
Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com
Posts: 400
Joined: Tue Oct 16, 2007 05:51 PM
Re: Sobre BTNBMP...
Posted: Wed Jun 04, 2014 04:38 PM
disculpas, esta es la imagen :

http://www.4shared.com/photo/03Hn6hp2ce ... s__1_.html?
" alt="" loading="lazy">
Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Sobre BTNBMP...
Posted: Wed Jun 04, 2014 11:30 PM
Albeiro,

Haciendo una peque帽a modificaci贸n en la Clase TBtnBmp Method Paint() puedes usar oBtn:bPainted y desde ah铆 escribir 贸 dibujar en el control lo que desees:

Code (fw): Select all Collapse
...
   
   if ::bPainted != nil   // nuevo
      Eval( ::bPainted, ::hDC, ::cPS, Self )  // nuevo
   endif  // nuevo  

   if ! IsWindowEnabled( ::hWnd ) .and. Empty( ::hBitmap3 )
      BtnDisable( ::hWnd, ::hDC )
   endif

   ...


Lo incluimos para la pr贸xima versi贸n de FWH :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 400
Joined: Tue Oct 16, 2007 05:51 PM
Re: Sobre BTNBMP...
Posted: Thu Jun 05, 2014 02:16 AM

Antonio,

Gracias :)

Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com
Posts: 400
Joined: Tue Oct 16, 2007 05:51 PM
Re: Sobre BTNBMP...
Posted: Sat Jul 26, 2014 02:28 AM
Antonio ,

Modifique la clase y probe con este ejemplo pero no funciona.

Code (fw): Select all Collapse
function PruebaBtnBmp()
聽 聽LOCAL oDlg, oFont, oBtn, aPos
聽 聽 聽 
聽 聽DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-12 BOLD 聽 
聽 聽
聽 聽DEFINE WINDOW oDlg TITLE "Say en Boton"

聽 聽@ 3, 16 BTNBMP oBtn OF oDlg; 聽
聽 聽 聽PROMPT "&Cancel"; 
聽 聽 聽CENTER;
聽 聽 聽SIZE 60, 60;
聽 聽 聽ACTION oDlg:End() 
聽 聽 聽 聽 聽 聽 聽
聽 聽 聽 聽 聽 聽 聽
聽 聽 // oBtn:bInit = {|| TSay():New(6, 14, {|| " 1 "}, oBtn,, oFont, .F., .F., .F., .F., CLR_BLACK, CLR_WHITE,,, .F., .F., .F., .F., .F., .F., .F., )}
聽 聽 
聽 聽 oBtn:bPainted = {|| TSay():New( 6, 14, {|| " 1 "}, oBtn,, oFont, .F., .F., .F., .F., CLR_BLACK, CLR_WHITE,,, .F., .F., .F., .F., .F., .F., .F., )}
聽 聽 
聽 聽ACTIVATE WINDOW oDlg 聽
聽 聽
聽 聽RELEASE FONT oFont
聽 聽 聽 
Return nil
Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: para Antonio : Sobre BTNBMP... oBtn:bPainted
Posted: Sun Jul 27, 2014 09:42 AM
Alveiro,

No, asi no hace, puesto que as铆 estarias creando un nuevo control TSay cada vez que se pintase el bot贸n, y eso consumir铆a muchos recursos y al final incluso podria tirar la aplicaci贸n.

La forma de escribir texto es usando la funci贸n DrawText() 贸 tambien servir铆a la funci贸n ExtTextOut():

oBtn:bPainted = { | hDC | DrawText( hDC, "Hola", { 0, 0, oBtnBmp:nWidth, oBtnBmp:nHeight }, nStyle )

Ese array de cuatro elementos es el rect谩ngulo en donde se escibir谩 el texto dentro de la superficie del bot贸n. nStyle es el estilo a usar de estos:

#define DT_TOP 0
#define DT_LEFT 0
#define DT_CENTER 1
#define DT_RIGHT 2
#define DT_VCENTER 4
#define DT_BOTTOM 8
#define DT_WORDBREAK 16
#define DT_SINGLELINE 32
#define DT_CALCRECT 1024

Para una explicaci贸n de estos estilos puedes revisar:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd162498(v=vs.85).aspx

Si deseas cambiar el color del texto a pintar, debes usar la funci贸n SetTextColor( hDC, CLR_BLUE ) (los colores estan en colors.ch, 贸 cualquier combinaci贸n RGB usando la funci贸n nRgb( nRed, nGreen, nBlue ) y llamarias a esta funci贸n desde el codeblock antes de llamar a DrawText()

Tambien puedes cambiar el font a usar, etc.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 400
Joined: Tue Oct 16, 2007 05:51 PM
Re: para Antonio : Sobre BTNBMP... oBtn:bPainted
Posted: Mon Jul 28, 2014 04:48 AM

Antonio ahora si funciono.

Gracias.

Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: para Antonio : Sobre BTNBMP... oBtn:bPainted (RESUELTO)
Posted: Mon Jul 28, 2014 05:29 PM

Muy bien :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 400
Joined: Tue Oct 16, 2007 05:51 PM
Re: para Antonio : Sobre BTNBMP... oBtn:bPainted (RESUELTO)
Posted: Fri Jan 16, 2015 01:48 PM

Antonio,

Buen dia, recuerda agregar este codigo a btnbmp.prg para el proximo build de fwh.

Saludos.

Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com
Posts: 1364
Joined: Wed Jun 21, 2006 12:39 AM
Re: para Antonio : Sobre BTNBMP... oBtn:bPainted (RESUELTO)
Posted: Fri Jan 16, 2015 10:33 PM
No encuentro esta parte del c贸digo que se supone se encuentra en el m茅todo Paint()


...

if ! IsWindowEnabled( ::hWnd ) .and. Empty( ::hBitmap3 )
BtnDisable( ::hWnd, ::hDC )
endif

...


Donde pongo el c贸digo nuevo ? Alguien sabe ?. Much铆simas gracias

Saludos

Continue the discussion