Redimensionar TTOOLBAR no FUNCIONA !!

Redimensionar TTOOLBAR no FUNCIONA !!

Postby WilliamAdami » Mon Aug 24, 2009 2:35 am

yo estoy utilizando la TTOOLBAR y no consigo redimensiona-la. Durante la execucion de lo programa mudo los valores de oToolbar1:nBtnWidth:= 300 , otoolbar1:nBtnHeight:=50 , otoolbar1:refresh() y no redimensiona corretamente la Toolbar.
Si altero los otoolbar1:nWidth y otoolbar1:nHeight la barra aumenta de tamano , mas sus botones no.

Seria un BUG ?


muchas gracias


Saludos


William Adami




yo defino la TTOOLBAR asi:

Local oImagelist1,odlg

DEFINE DIALOG ODLG ...

ACTIVATE DIALOG oDlg on init CREABARRA( @oImageList1,odlg )
* apos definir la toolbar , no consigo redimensionar corretamente





FUNCTION CREABARRA( oImageList1, oWnd )

LOCAL oToolBar1

// First we build the imagelists with all the bitmaps
oImageList1 = TImageList():New( 32, 32 ) // width and height of bitmaps
oImageList1:AddMasked( TBitmap():Define( "new",, oWnd ), nRGB( 255, 0, 255 ) )
oImageList1:AddMasked( TBitmap():Define( "open",, oWnd ), nRGB( 255, 0, 255 ) )

oToolBar1 = TToolBar():New( oWnd, 50, 50, oImageList1 )

oToolBar1:AddButton( { || MsgInfo( "New" ) }, "New", "New project" )
oToolBar1:AddButton( { || MsgInfo( "Open" ) }, "Open", "Open project" )

RETURN .T.
WilliamAdami
 
Posts: 68
Joined: Tue Apr 14, 2009 9:26 pm
Location: Brasil

Re: Redimensionar TTOOLBAR no FUNCIONA !!

Postby Daniel Garcia-Gil » Mon Aug 24, 2009 3:20 am

Hola William

el problema no esta en la ToolBar....

WilliamAdami wrote: Si altero los otoolbar1:nWidth y otoolbar1:nHeight la barra aumenta de tamano, mas sus botones no.


el problema son los botones, prueba eliminar la lista de imagenes y crearla con una nueva dimension.
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Redimensionar TTOOLBAR no FUNCIONA !!

Postby WilliamAdami » Mon Aug 24, 2009 12:54 pm

Daniel , gracias por responder-me. Lo redimensionamento de la toolbar sera durante la execucion de lo programa, baseando-se em :

for i=1 to len(odlg:acontrols)

if odlg:acontrols[i] = "TTOOLBAR"

*** aqui se redimensiona lo toolbar

endif


next

Como quitar la Imagelist e cria-la novamente com los bitmaps já redimensionados ?

Necessito fazer isso con base en lo odlg:acontrols[i]

Desde ja, muchas gracias


Saludos

William
WilliamAdami
 
Posts: 68
Joined: Tue Apr 14, 2009 9:26 pm
Location: Brasil

Re: Redimensionar TTOOLBAR no FUNCIONA !!

Postby Daniel Garcia-Gil » Mon Aug 24, 2009 1:00 pm

Hola William...

Este ejemplo tiene una pequeña modificacion de samples\toolbar4.prg
Code: Select all  Expand view
// Win32 TReBar and TToolBar sample into DIALOGS

#include "FiveWin.ch"

function Main()

   local oWnd, oReBar, oToolBar1, oToolBar2, oImageList1, oImageList2, oImageList3

   DEFINE DIALOG oWnd NAME "DIALOG" TITLE "FWH - Testing Win32 ReBars & Toolbars"

   ACTIVATE DIALOG oWnd ;
      ON INIT CREABARRA( @oImageList1, @oImageList2, @oImageList3, oWnd )

   oImageList1:End()
   oImageList2:End()
   oImageList3:End()

return nil

FUNCTION CREABARRA( oImageList1, oImageList2, oImageList3, oWnd )

   LOCAL oReBar, oToolBar1, oToolBar2

   // First we build the imagelists with all the bitmaps
   oImageList1 = TImageList():New( 32, 32 ) // width and height of bitmaps

   oImageList1:AddMasked( TBitmap():Define( "new",,    oWnd ), nRGB( 255, 0, 255 ) )
   oImageList1:AddMasked( TBitmap():Define( "open",,   oWnd ), nRGB( 255, 0, 255 ) )
   oImageList1:AddMasked( TBitmap():Define( "search",, oWnd ), nRGB( 255, 0, 255 ) )
   oImageList1:AddMasked( TBitmap():Define( "print",,  oWnd ), nRGB( 255, 0, 255 ) )

   oImageList3 = TImageList():New( 16, 16 ) // width and height of bitmaps

   oImageList3:AddMasked( TBitmap():Define( "new",,    oWnd ), nRGB( 255, 0, 255 ) )
   oImageList3:AddMasked( TBitmap():Define( "open",,   oWnd ), nRGB( 255, 0, 255 ) )
   oImageList3:AddMasked( TBitmap():Define( "search",, oWnd ), nRGB( 255, 0, 255 ) )
   oImageList3:AddMasked( TBitmap():Define( "print",,  oWnd ), nRGB( 255, 0, 255 ) )



   oImageList2 = TImageList():New( 32, 32 ) // width and height of bitmaps
   oImageList2:AddMasked( TBitmap():Define( "internet",, oWnd ), nRGB( 255, 0, 255 ) )
   oImageList2:AddMasked( TBitmap():Define( "keys",, oWnd ), nRGB( 255, 0, 255 ) )
   oImageList2:AddMasked( TBitmap():Define( "quit",, oWnd ), nRGB( 255, 0, 255 ) )

   // Now we create the rebar
   oReBar = TReBar():New( oWnd )

   // Now we create the toolbars and add the buttons
   oToolBar1 = TToolBar():New( oReBar, 50, 50, oImageList1 )
   oToolBar1:AddButton( { || MsgInfo( "New" ) }, "New", "New project" )
   oToolBar1:AddButton( { || MsgInfo( "Open" ) }, "Open", "Open project" )
   oToolBar1:AddSeparator()
   oToolBar1:AddButton( { || MsgInfo( "Search" ) }, "Search", "Search" )
   oToolBar1:AddButton( { || MsgInfo( "Print" ) }, "Print a report", "Print" )

   oToolBar2 = TToolBar():New( oReBar, 50, 50, oImageList2 )
   oToolBar2:AddButton( { || MsgInfo( "Upgrade" ) }, "Search for new versions",;
                       "Upgrade..." )
   oToolBar2:AddButton( { || oToolBar1:nBtnWidth := 16, oToolBar1:nBtnHeight := 16,;
                             oImageList1:End(),  ;
                             SendMessage( oToolBar1:hWnd, 1072, 0, oImageList3:hImageList ),;
                             oToolBar1:Refresh() }, "Users management", "Users" )
   oToolBar2:AddSeparator()
   oToolBar2:AddButton( { || oWnd:End() }, "End Application", "Exit" )

   // We set the widths for each toolbar
   oToolBar1:nWidth = 290
   oToolBar2:nWidth = 300

   // Now we insert the toolbars into the rebar
   oReBar:InsertBand( oToolBar1 )
   oReBar:InsertBand( oToolBar2 )

RETURN .T.
 
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 18 guests