Sobre TRbtn y BtnBmp (solucionado)

Sobre TRbtn y BtnBmp (solucionado)

Postby AngelSalom » Wed Jun 19, 2019 10:11 am

Hola! Estoy sustituyendo en mis aplicaciones los TRbtn por TBtnBmp y observo una pequeña diferencia en el pintado del botón con imagen (layout "LEFT")
En este caso el botón de la izquierda es un TbtnBmp y el de la derecha un TRbtn, ¿posibilidad de que TBtnBmp quede como el TRbtn?

Image

Gracias!
Last edited by AngelSalom on Thu Jun 20, 2019 6:28 am, edited 1 time in total.
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
User avatar
AngelSalom
 
Posts: 708
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Re: Sobre TRbtn y BtnBmp

Postby nageswaragunupudi » Wed Jun 19, 2019 3:27 pm

Please give your code for creating the BtnBmp.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10247
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Sobre TRbtn y BtnBmp

Postby AngelSalom » Wed Jun 19, 2019 7:03 pm

Of course, here's a self-contained example

Code: Select all  Expand view
#include "fivewin.ch"
#include "ribbon.ch"

Function Main()
    Local oDlg, oBtn, oFont
    Local bGradColors:= { | lInvert | If( lInvert, ;
                                        {  { 1, nRgb (255,225,131), nRgb (255,225,131) }, }, ;
                                        {  { 1, CLR_WHITE, CLR_WHITE  }, };
                                      );
                      }
 
    DEFINE FONT oFont NAME GetSysFont() SIZE 0,12 POINTS                  
    DEFINE DIALOG oDlg FROM 0,0 TO 24,79 TITLE "Prueba TBtnBmp" FONT oFont

    @ 5,5 BTNBMP oBtn FILE "..\bitmaps\alphabmp\windows.bmp" SIZE 150,40 ACTION oDlg:End() PROMPT "Prueba TBtnBmp";
                      LEFT GRADIENT bGradColors 2007 FONT oFont

    @ 50,5 RBBTN oBtn BITMAP "..\bitmaps\alphabmp\windows.bmp" SIZE 150,40 ACTION oDlg:End() PROMPT "Prueba TRbtn";
                      LEFT BORDER FONT oFont
   
    ACTIVATE DIALOG oDlg CENTERED
    RELEASE FONT oFont

Return (nil)    
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
User avatar
AngelSalom
 
Posts: 708
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Re: Sobre TRbtn y BtnBmp

Postby nageswaragunupudi » Thu Jun 20, 2019 12:14 am

Not exactly like RBBtn, but these are the possible configurations. Optionally, you can specify the position of the bitmap with oBtn:aBmpRect := { t, l, b, r }

Image

Code: Select all  Expand view
#include "fivewin.ch"

Function Main()

    Local oDlg, oBtn, oFont
    Local bGradColors:= { | lInvert | If( lInvert, ;
                                        {  { 1, nRgb (255,225,131), nRgb (255,225,131) }, }, ;
                                        {  { 1, CLR_WHITE, CLR_WHITE  }, };
                                      );
                      }

    DEFINE FONT oFont NAME GetSysFont() SIZE 0,12 POINTS
    DEFINE DIALOG oDlg SIZE 400,500 PIXEL TITLE "Prueba TBtnBmp" FONT oFont TRUEPIXEL

    @  10,10 RBBTN oBtn BITMAP "..\bitmaps\alphabmp\windows.bmp" SIZE 300,80 ACTION oDlg:End() PROMPT "Prueba TRbtn";
                      LEFT BORDER FONT oFont

    @ 100,10 BTNBMP oBtn FILE "..\bitmaps\alphabmp\windows.bmp" SIZE 300,80 ACTION oDlg:End() PROMPT "Prueba TBtnBmp";
                      LEFT GRADIENT bGradColors 2007 FONT oFont

    @ 190,10 BTNBMP oBtn FILE "..\bitmaps\alphabmp\windows.bmp" SIZE 300,80 ACTION oDlg:End() PROMPT "Prueba TBtnBmp ";
                      LEFT GRADIENT bGradColors 2007 FONT oFont

    @ 280,10 BTNBMP oBtn FILE "..\bitmaps\alphabmp\windows.bmp" SIZE 300,80 ACTION oDlg:End() PROMPT " Prueba TBtnBmp ";
                      LEFT GRADIENT bGradColors 2007 FONT oFont

    @ 370,10 BTNBMP oBtn FILE "..\bitmaps\alphabmp\windows.bmp" SIZE 300,80 ACTION oDlg:End() PROMPT " Prueba TBtnBmp ";
                      LEFT GRADIENT bGradColors 2007 FONT oFont

    oBtn:aBmpRect    := { 0, 50, 80, 80 }

    ACTIVATE DIALOG oDlg CENTERED
    RELEASE FONT oFont

Return (nil)
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10247
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Sobre TRbtn y BtnBmp

Postby AngelSalom » Thu Jun 20, 2019 6:28 am

Solved, thanks.
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
User avatar
AngelSalom
 
Posts: 708
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Re: Sobre TRbtn y BtnBmp (solucionado)

Postby jvtecheto » Thu Jun 20, 2019 6:50 am

Mr. Rao.

From Resources , not work .....

Code: Select all  Expand view

REDEFINE BTNBMP oBtn ID 110 OF oDlg RESOURCE "Edit" ACTION MsgInfo("Editando Ficha") LEFT
oBtn:aBmpRect    := { 0, 50, 80, 80 }
 


How calc de positions oBtn:aBmpRect := { xx?, xx??, xx??, xx?? } ?

Regards

Jose
Fwh 19.06 32 bits + Harbour 3.2dev(r2104281802) + Borland 7.4 + FivEdit
User avatar
jvtecheto
 
Posts: 576
Joined: Mon Mar 04, 2013 4:32 pm
Location: Spain

Re: Sobre TRbtn y BtnBmp (solucionado)

Postby nageswaragunupudi » Thu Jun 20, 2019 7:00 am

oBtn:aBmpRect := { nTop, nLeft, nBottom, nRight }
in pixels relative to the BtnBmp's rect.

Should work with resources also.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10247
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Sobre TRbtn y BtnBmp (solucionado)

Postby AngelSalom » Thu Jun 20, 2019 7:06 am

nageswaragunupudi wrote:oBtn:aBmpRect := { nTop, nLeft, nBottom, nRight }
in pixels relative to the BtnBmp's rect.

Should work with resources also.


Yes, it works with resources.
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
User avatar
AngelSalom
 
Posts: 708
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Re: Sobre TRbtn y BtnBmp (solucionado)

Postby jvtecheto » Thu Jun 20, 2019 10:42 am

AngelSalom wrote:
nageswaragunupudi wrote:oBtn:aBmpRect := { nTop, nLeft, nBottom, nRight }
in pixels relative to the BtnBmp's rect.

Should work with resources also.


Yes, it works with resources.


Hola lo siento pero no entiendo como lo haceis.
a ver yo tengo en recursos un BtnBmp situado en
X Position : 180
Y Position : 100
width: 80
Height: 15

Entonces hago:

Code: Select all  Expand view

oBtn:aBmpRect := { 105, 185, 120, 265 }
 


Y no aparece el boton.

¿Como lo calculais ?

Gracias y perdon por la confusion.

Off Totip : Por cierto, Angel estamos muy cerca.... (Estoy en Santa Magdalena de Pulpis) Perdon

Saludos.
Fwh 19.06 32 bits + Harbour 3.2dev(r2104281802) + Borland 7.4 + FivEdit
User avatar
jvtecheto
 
Posts: 576
Joined: Mon Mar 04, 2013 4:32 pm
Location: Spain

Re: Sobre TRbtn y BtnBmp (solucionado)

Postby cnavarro » Thu Jun 20, 2019 12:44 pm

Jose, las coordenadas son respecto al propio boton : { 2, 2 , 40, 40 }, por ejemplo, y no a las coordenadas del contenedor donde está ubicado el botón
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Sobre TRbtn y BtnBmp (solucionado)

Postby AngelSalom » Thu Jun 20, 2019 1:25 pm

brakaman wrote:
AngelSalom wrote:
nageswaragunupudi wrote:oBtn:aBmpRect := { nTop, nLeft, nBottom, nRight }
in pixels relative to the BtnBmp's rect.

Should work with resources also.


Yes, it works with resources.


Hola lo siento pero no entiendo como lo haceis.
a ver yo tengo en recursos un BtnBmp situado en
X Position : 180
Y Position : 100
width: 80
Height: 15

Entonces hago:

Code: Select all  Expand view

oBtn:aBmpRect := { 105, 185, 120, 265 }
 


Y no aparece el boton.

¿Como lo calculais ?

Gracias y perdon por la confusion.

Off Totip : Por cierto, Angel estamos muy cerca.... (Estoy en Santa Magdalena de Pulpis) Perdon

Saludos.


Es tal como te comenta Cristóbal. Si lo mandas a las posiciones que indicas la imagen se sale del botón.
Si lo necesitas cuelgo un ejemplo desde recursos.

Así que prácticamente somos vecinos, genial, está bien saberlo! :D
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
User avatar
AngelSalom
 
Posts: 708
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Re: Sobre TRbtn y BtnBmp (solucionado)

Postby jvtecheto » Thu Jun 20, 2019 3:24 pm

Es tal como te comenta Cristóbal. Si lo mandas a las posiciones que indicas la imagen se sale del botón.
Si lo necesitas cuelgo un ejemplo desde recursos.

Así que prácticamente somos vecinos, genial, está bien saberlo! :D[/quote]

:D

Parece ser que tengo el dia malo, ya comprendido lo de las coordenadas me pinta el boton pero las clausulas
LETF = Aparece a la derecha
RIGHT = Aparece en el borde izquierdo y se come el boton.
CENTER = Este si aparece bien OK.

O sea al reves.
Intento mostrar imagenes.
[img]
https://ibb.co/gWj9bYD
https://ibb.co/yPGV9J5
https://ibb.co/7Yw8FMX
[/img]

Saludos.
Fwh 19.06 32 bits + Harbour 3.2dev(r2104281802) + Borland 7.4 + FivEdit
User avatar
jvtecheto
 
Posts: 576
Joined: Mon Mar 04, 2013 4:32 pm
Location: Spain

Re: Sobre TRbtn y BtnBmp (solucionado)

Postby AngelSalom » Thu Jun 20, 2019 3:48 pm

Si, hay que pillarle el concepto ... yo casi tiro la toalla hasta que ví la explicación de Mr. Rao

Suponiendo que se usa la cláusula LEFT , para ajustar el texto hay que fijarse en el PROMPT:
- "Prueba BtnBmp" pone el texto a la derecha
- "Prueba BtnBmp " (atento al espacio al final) pone el texto pegado a la imagen de la izquierda
- " Prueba BtnBmp " (espacios al principio y al final) deja el texto centrado y la imagen a la izquierda (esta es la opción que he usado yo, creo que la más elegante).
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
User avatar
AngelSalom
 
Posts: 708
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Re: Sobre TRbtn y BtnBmp (solucionado)

Postby jvtecheto » Thu Jun 20, 2019 4:05 pm

bUFFF.

Ahora si Angel. Muchisimasss gracias.

Tienes razon lo mas elegante es espacio inicial y final. OK.

Saludos.

Jose
Fwh 19.06 32 bits + Harbour 3.2dev(r2104281802) + Borland 7.4 + FivEdit
User avatar
jvtecheto
 
Posts: 576
Joined: Mon Mar 04, 2013 4:32 pm
Location: Spain


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 61 guests