Page 1 of 1

TReBar

PostPosted: Fri Jun 02, 2006 4:18 am
by AntonioCrisostomo
He codificado, según el ejemplo.


local oWnd, oReBar, oToolBar, oPanel, oBtn1, oFolder, oToolBar2
local oImageList

DEFINE WINDOW oWnd TITLE "Testing rebars and toolbars" ;
MENU BuildMenu()

oReBar = TReBar():New( oWnd )

oPanel := TPanel():New( 0, 0, 75, 300, oReBar )

oImageList = TImageList():New()

oImageList:AddMasked( TBitmap():Define( , "new2.bmp", oWnd ),;
nRGB( 255, 0, 255 ) )
oImageList:AddMasked( TBitmap():Define( , "open2.bmp", oWnd ),;
nRGB( 255, 0, 255 ) )

oImageList:Add( TBitmap():Define( , "icon.bmp", oWnd ),;
TBitmap():Define( , "icoMask.bmp", oWnd ) )

oToolBar = TToolBar():New( oPanel, 33, 33, oImageList )
oToolBar:nLeft = 5
oToolBar:AddButton( { || MsgInfo( "New" ) }, "New" ) // , "new file" )
oToolBar:AddButton( { || MsgInfo( "Open" ) }, "Open" )
oToolBar:AddButton( { || MsgInfo( "three" ) }, "three" )
oToolBar:AddSeparator()
oToolBar:AddButton( { || MsgInfo( "four" ) }, "four" )

oReBar:InsertBand( oPanel )

@ 10, 2 FOLDER oFolder PROMPTS "One", "Two", "Three" SIZE 400, 62

oToolBar2 = TToolBar():New( oFolder:aDialogs[ 1 ],,, oImageList )
oToolBar2:AddButton( { || MsgInfo( "pointer" ) }, "pointer" )
oToolBar2:AddSeparator()
oToolBar2:AddButton( ,"label" )
oToolBar2:AddButton( ,"button" )

oReBar:InsertBand( oFolder )

DEFINE STATUSBAR OF oWnd PROMPT "Rebars and Toolbars test"

ACTIVATE WINDOW oWnd MAXIMIZED

oImageList:End()

Pero no se visualizan los Bitmaps a pesar que dichos archivos existen. Gracias por su respueta

Fwh 2.5 Noviembre for Xharbour 0.99.2

PostPosted: Fri Jun 02, 2006 6:03 am
by Antonio Linares
Antonio,

Al crear el objeto ImageList te falta especificar el tamaño de los bitmaps:

oImageList = TImageList():New( 32, 32 )

y los bitmaps tienen que tener ese tamaño.

PostPosted: Fri Jun 23, 2006 1:50 pm
by goosfancito
Güenas y Santas,

Esta parte de codigo:

Code: Select all  Expand view
oImageList:AddMasked( TBitmap():Define( , "new2.bmp", oWnd ),;
nRGB( 255, 0, 255 ) )


levanta la imagen desde el disco.

Como hago para que la saque de un .res?

Gracias.

Auto-me respondo

PostPosted: Fri Jun 23, 2006 2:22 pm
by goosfancito
Gracias _

Code: Select all  Expand view
oImageList:AddMasked( TBitmap():Define( , "new2.bmp", oWnd ),;
nRGB( 255, 0, 255 ) )


el primer parametro despues del define( se lo utiliza para decirle que debe tomar la imagen desde un recurso.

Code: Select all  Expand view
oImageList:AddMasked( TBitmap():Define( "new2", , oWnd ),;
nRGB( 255, 0, 255 ) )

Asi, tomaria NEW2 desde un recurso.

Re: Auto-me respondo

PostPosted: Fri Jun 23, 2006 5:52 pm
by jose_murugosa
goosfancito wrote:Gracias _

Code: Select all  Expand view
oImageList:AddMasked( TBitmap():Define( , "new2.bmp", oWnd ),;
nRGB( 255, 0, 255 ) )


el primer parametro despues del define( se lo utiliza para decirle que debe tomar la imagen desde un recurso.

Code: Select all  Expand view
oImageList:AddMasked( TBitmap():Define( "new2", , oWnd ),;
nRGB( 255, 0, 255 ) )

Asi, tomaria NEW2 desde un recurso.


Gracias por compartir la solución con nosotros :D