Hi,
how is possible to change the text of a button in a toolbar?
Thank you
Change text button Toolbar
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Riccardo,
You have to add this method to Class TToolBar:
And this code to your app:
Then use it this way:
You have to add this method to Class TToolBar:
Code: Select all
METHOD SetText( nButton, cText ) INLINE TBSetText( ::hWnd, nButton, cText )
Code: Select all
#pragma BEGINDUMP
#include <hbapi.h>
#include <Windows.h>
#include <CommCtrl.h>
HB_FUNC( TBSETTEXT )
{
HWND hToolBar = ( HWND ) hb_parnl( 1 );
TBBUTTONINFO tbi;
memset( ( char * ) &tbi, 0, sizeof( tbi ) );
tbi.dwMask = TBIF_TEXT | TBIF_BYINDEX;
tbi.cbSize = sizeof( TBBUTTONINFO );
tbi.pszText = hb_parc( 3 );
tbi.cchText = hb_parclen( 3 );
SendMessage( hToolBar, TB_SETBUTTONINFO, hb_parni( 2 ) - 1, ( LPARAM ) &tbi );
}
Code: Select all
oToolbar:SetText( 1, "Hello" ) // set first button text
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact: