Sobre TRbtn y BtnBmp (solucionado)

Post Reply
User avatar
AngelSalom
Posts: 727
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España
Has thanked: 1 time
Contact:

Sobre TRbtn y BtnBmp (solucionado)

Post by AngelSalom »

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
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: Sobre TRbtn y BtnBmp

Post by nageswaragunupudi »

Please give your code for creating the BtnBmp.
Regards

G. N. Rao.
Hyderabad, India
User avatar
AngelSalom
Posts: 727
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España
Has thanked: 1 time
Contact:

Re: Sobre TRbtn y BtnBmp

Post by AngelSalom »

Of course, here's a self-contained example

Code: Select all | Expand

#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
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: Sobre TRbtn y BtnBmp

Post by nageswaragunupudi »

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

#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
AngelSalom
Posts: 727
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España
Has thanked: 1 time
Contact:

Re: Sobre TRbtn y BtnBmp

Post by AngelSalom »

Solved, thanks.
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
User avatar
jvtecheto
Posts: 603
Joined: Mon Mar 04, 2013 4:32 pm
Location: Spain

Re: Sobre TRbtn y BtnBmp (solucionado)

Post by jvtecheto »

Mr. Rao.

From Resources , not work .....

Code: Select all | Expand


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 24.07 64 bits + Harbour 64 bits 3.2dev(r2407221137) + MSVC64
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: Sobre TRbtn y BtnBmp (solucionado)

Post by nageswaragunupudi »

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
AngelSalom
Posts: 727
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España
Has thanked: 1 time
Contact:

Re: Sobre TRbtn y BtnBmp (solucionado)

Post by AngelSalom »

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
jvtecheto
Posts: 603
Joined: Mon Mar 04, 2013 4:32 pm
Location: Spain

Re: Sobre TRbtn y BtnBmp (solucionado)

Post by jvtecheto »

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


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 24.07 64 bits + Harbour 64 bits 3.2dev(r2407221137) + MSVC64
User avatar
cnavarro
Posts: 6557
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Been thanked: 3 times

Re: Sobre TRbtn y BtnBmp (solucionado)

Post by cnavarro »

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
AngelSalom
Posts: 727
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España
Has thanked: 1 time
Contact:

Re: Sobre TRbtn y BtnBmp (solucionado)

Post by AngelSalom »

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


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
jvtecheto
Posts: 603
Joined: Mon Mar 04, 2013 4:32 pm
Location: Spain

Re: Sobre TRbtn y BtnBmp (solucionado)

Post by jvtecheto »

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 24.07 64 bits + Harbour 64 bits 3.2dev(r2407221137) + MSVC64
User avatar
AngelSalom
Posts: 727
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España
Has thanked: 1 time
Contact:

Re: Sobre TRbtn y BtnBmp (solucionado)

Post by AngelSalom »

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
jvtecheto
Posts: 603
Joined: Mon Mar 04, 2013 4:32 pm
Location: Spain

Re: Sobre TRbtn y BtnBmp (solucionado)

Post by jvtecheto »

bUFFF.

Ahora si Angel. Muchisimasss gracias.

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

Saludos.

Jose
Fwh 24.07 64 bits + Harbour 64 bits 3.2dev(r2407221137) + MSVC64
Post Reply