FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Tamaño de los botones en una toolbar
Posts: 989
Joined: Thu Nov 24, 2005 03:01 PM
Tamaño de los botones en una toolbar
Posted: Fri Nov 07, 2008 12:25 PM

Hola Antonio,

Cuando uso las toolbars todos los botones asumen automáticamente el ancho del botón más ancho. ¿Es posible hacer que cada uno tenga el tamaño según su texto? Es decir, un botón con el texto Salir debería ser bastante más fino que uno con el texto 'Listado de Facturas'.
Probablemente (como sospecho) es el comportamiento normal de windows, al menos mirando el MSDN no he encontrado aún como hacerlo, a ver si este finde encuentro algo.

Un saludo,

Carlos.

Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Tamaño de los botones en una toolbar
Posted: Fri Nov 07, 2008 01:27 PM

Carlos,

Por lo visto todos tienen que tener las mismas dimensiones.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1364
Joined: Wed Jun 21, 2006 12:39 AM
Tamaño de los botones en una toolbar
Posted: Fri Nov 07, 2008 03:35 PM

Aqui te mando la función que hace lo que necesitas. En tu código lo manejas así.

AEval( oToolBar : aButtons, { | aBtn, nBtn| CAMBIA_EL_SIZE_DEL_BOTON( oToolBar : hWnd, nBtn, nOr( 0x0010 ) ) } )

pragma BEGINDUMP

#include <windows.h>
#include <commctrl.h>
#include "hbapi.h"

/-----------------------------------------------------------------------------------------------/
HB_FUNC( CAMBIA_EL_SIZE_DEL_BOTON ){
TBBUTTONINFO tbutton;
tbutton.cbSize = sizeof( tbutton );
tbutton.dwMask = TBIF_STYLE;
SendMessage( ( HWND ) hb_parnl( 1 ), TB_GETBUTTONINFO, ( WPARAM ) hb_parni( 2 ), (LPARAM) &tbutton );
tbutton.fsStyle = hb_parni( 3 );
SendMessage( ( HWND ) hb_parnl( 1 ), TB_SETBUTTONINFO, ( WPARAM ) hb_parni( 2 ), (LPARAM) &tbutton );
}

pragma ENDDUMP

Posts: 989
Joined: Thu Nov 24, 2005 03:01 PM
Tamaño de los botones en una toolbar
Posted: Fri Nov 07, 2008 06:00 PM

Gracias horacio, lo pruebo y te cuento como me fue.

Un saludo,

Carlos.

Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
Posts: 989
Joined: Thu Nov 24, 2005 03:01 PM
Tamaño de los botones en una toolbar
Posted: Sun Nov 09, 2008 11:24 AM

Grande Horacio!

funcionó perfecto. No usé la rutina exactamente como la pasaste, pero pude hacer la que necesitaba.
Muchas gracias,

Carlos.

Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"

Continue the discussion