Page 1 of 1

Position Toolbar

Posted: Mon Aug 04, 2014 11:08 am
by ctoas
Hello friends.

How to change the position of the toolbar as shown in picture?

Thank you

Image

Re: Position Toolbar

Posted: Mon Aug 04, 2014 12:41 pm
by Enrico Maria Giordano

Code: Select all

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oWnd

    LOCAL oBar

    SETBALLOON( .T. )

    DEFINE WINDOW oWnd

    DEFINE BUTTONBAR OF oWnd 2007;
           SIZE 33, 33

    DEFINE BUTTON OF oWnd:oBar;
           FILE "E:\FWHARBOUR\BITMAPS\OPEN.BMP";
           ACTION MSGINFO( "First bar Ok!" );
           TOOLTIP "This is a test"

    @ 33, -1 BUTTONBAR oBar OF oWnd;
             SIZE 1602, 36;
             BUTTONSIZE 60, 33

    oBar:l2007 = .T.

    DEFINE BUTTON OF oBar;
           FILE "E:\FWHARBOUR\BITMAPS\SAVE.BMP";
           ACTION MSGINFO( "Second bar Ok!" )

    ACTIVATE WINDOW oWnd

    RETURN NIL
EMG

Re: Position Toolbar

Posted: Mon Aug 04, 2014 1:04 pm
by ctoas
Hello Enrico, is not a ButtonBar, but the Toolbar as PRG below

Code: Select all

********************************************************************************
FUNCTION TESTE()
********************************************************************************

    DEFINE DIALOG oDlg RESOURCE "TESTE" TITLE "TESTE" FONT wfonte_FixedSys 
    
    ACTIVATE DIALOG oDlgAGENDA CENTERED ON INIT (BARRABOTOESAGENDA())
        
RETURN NIL    

********************************************************************************
FUNCTION BARRABOTOESAGENDA()
********************************************************************************

    **** TOOLBAR - TAMANHOS DOS BOTÕES               
    oImageList = TImageList():New(48,48)      
    oImageList2 = TImageList():New(48,48)      
                                                           
    **** TOOLBAR - IMAGENS DOS BOTÕES   
    oImageList :AddMasked(TBitmap():Define("DIAG_BAR_NOVO"      ,,oDlgAGENDA),nRGB(255,255,255))   
    oImageList :AddMasked(TBitmap():Define("DIAG_BAR_NOVO_MULT" ,,oDlgAGENDA),nRGB(255,255,255))   
    oImageList :AddMasked(TBitmap():Define("DIAG_BAR_VISUALIZAR",,oDlgAGENDA),nRGB(255,255,255))   
    oImageList :AddMasked(TBitmap():Define("DIAG_BAR_ALTERAR"   ,,oDlgAGENDA),nRGB(255,255,255))   
    oImageList :AddMasked(TBitmap():Define("DIAG_BAR_EXCLUIR"   ,,oDlgAGENDA),nRGB(255,255,255))   
    oImageList :AddMasked(TBitmap():Define("DIAG_BAR_IMPRESSAO" ,,oDlgAGENDA),nRGB(255,255,255))   
    oImageList2:AddMasked(TBitmap():Define("DIAG_BAR_SAIR"      ,,oDlgAGENDA),nRGB(255,255,255))   
                                           
    DEFINE REBAR oReBar OF oDlgAGENDA
    
    **** TOOLBAR - DEFINE   
    DEFINE TOOLBAR oToolBarAGENDA  OF oReBar SIZE 52,52 IMAGELIST oImageList  BALLOON 
    DEFINE TOOLBAR oToolBarAGENDA2 OF oReBar SIZE 52,52 IMAGELIST oImageList2 BALLOON

    oToolBarAGENDA:nWidth  = 335
    oToolBarAGENDA2:nWidth = 58
   
   oReBar:InsertBand( oToolBarAGENDA )
   oReBar:InsertBand( oToolBarAGENDA2 )
   
RETURN NIL

oImageList:END()
oImageList2:END()
 

Re: Position Toolbar

Posted: Mon Aug 04, 2014 1:16 pm
by Enrico Maria Giordano
Christiano,

uh, sorry, I never used a REBAR. :-(

EMG

Re: Position Toolbar

Posted: Mon Aug 04, 2014 1:40 pm
by ctoas
Enrico Thanks for your attention

Re: Position Toolbar

Posted: Mon Aug 04, 2014 2:33 pm
by Antonio Linares
Christiano,

Could you post the source code that you are using to build it ? thanks

Re: Position Toolbar

Posted: Mon Aug 04, 2014 2:50 pm
by ctoas
Hello Antonio, Thanks for responding.

The source code is exactly what I posted above.

Re: Position Toolbar

Posted: Mon Aug 04, 2014 3:06 pm
by Antonio Linares
Christiano,

I missed that post, thanks

Pease provide the source code for the RC "TESTE" dialog, thanks

Re: Position Toolbar

Posted: Mon Aug 04, 2014 3:16 pm
by ctoas
Antonio, I do not include the ToolBar RES / RC as you can see in the source code below. This way I do this wrong?

Code: Select all

********************************************************************************
FUNCTION TESTE()
********************************************************************************

    DEFINE DIALOG oDlg RESOURCE "TESTE" TITLE APPNAME + "TESTE" FONT wfonte_FixedSys 
    
   ACTIVATE DIALOG oDlgAGENDA CENTERED ON INIT (BARRABOTOESAGENDA())
        
RETURN NIL    

********************************************************************************
FUNCTION BARRABOTOESAGENDA()
********************************************************************************

    **** TOOLBAR - TAMANHOS DOS BOTÕES               
    oImageList = TImageList():New(48,48)      
    oImageList2 = TImageList():New(48,48)      
                                                           
    **** TOOLBAR - IMAGENS DOS BOTÕES   
    oImageList :AddMasked(TBitmap():Define("DIAG_BAR_NOVO"      ,,oDlgAGENDA),nRGB(255,255,255))   
    oImageList :AddMasked(TBitmap():Define("DIAG_BAR_NOVO_MULT" ,,oDlgAGENDA),nRGB(255,255,255))   
    oImageList :AddMasked(TBitmap():Define("DIAG_BAR_VISUALIZAR",,oDlgAGENDA),nRGB(255,255,255))   
    oImageList :AddMasked(TBitmap():Define("DIAG_BAR_ALTERAR"   ,,oDlgAGENDA),nRGB(255,255,255))   
    oImageList :AddMasked(TBitmap():Define("DIAG_BAR_EXCLUIR"   ,,oDlgAGENDA),nRGB(255,255,255))   
    oImageList :AddMasked(TBitmap():Define("DIAG_BAR_IMPRESSAO" ,,oDlgAGENDA),nRGB(255,255,255))   
    oImageList2:AddMasked(TBitmap():Define("DIAG_BAR_SAIR"      ,,oDlgAGENDA),nRGB(255,255,255))   
                                           
    DEFINE REBAR oReBar OF oDlgAGENDA
    
    **** TOOLBAR - DEFINE   
    DEFINE TOOLBAR oToolBarAGENDA  OF oReBar SIZE 52,52 IMAGELIST oImageList  BALLOON 
    DEFINE TOOLBAR oToolBarAGENDA2 OF oReBar SIZE 52,52 IMAGELIST oImageList2 BALLOON

    oToolBarAGENDA:nWidth  = 335
   oToolBarAGENDA2:nWidth = 58
   
   oReBar:InsertBand( oToolBarAGENDA )
   oReBar:InsertBand( oToolBarAGENDA2 )
   
RETURN NIL

oImageList:END()
oImageList2:END()
 
TESTE.RC

Code: Select all

// RESOURCE SCRIPT generated by "Pelles C for Windows, version 7.00".

#include <windows.h>
#include <commctrl.h>
#include <richedit.h>

LANGUAGE LANG_PORTUGUESE,SUBLANG_PORTUGUESE_BRAZILIAN

TESTE DIALOGEX DISCARDABLE 6, 18, 284, 329
STYLE WS_POPUP|DS_MODALFRAME|DS_3DLOOK|WS_CAPTION|WS_VISIBLE
FONT 9, "Fixedsys", 0, 0, 1
{
}
 

Re: Position Toolbar

Posted: Mon Aug 04, 2014 5:18 pm
by Antonio Linares
Chirstiano,

Please try this example:

Code: Select all

#include "FiveWin.ch"

function Main()

   local oWnd, oReBar, oToolBar1, oImageList1

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

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

   oImageList1:End()

return nil

FUNCTION CREABARRA( oImageList1, oWnd )

   LOCAL oReBar, 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 ) )
   oImageList1:AddMasked( TBitmap():Define( "search",, oWnd ), nRGB( 255, 0, 255 ) )
   oImageList1:AddMasked( TBitmap():Define( "print",,  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, 52, 52, 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" )

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

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

RETURN .T.
 

Re: Position Toolbar

Posted: Mon Aug 04, 2014 7:34 pm
by ctoas
Antonio, thanks for help me, but the way you showed is just like this already, I want this shown in the image below assembly.


Image

I want be like this.
Image

Re: Position Toolbar

Posted: Mon Aug 04, 2014 11:39 pm
by Antonio Linares
Christiano,

En mi ejemplo solo tienes que añadir esta línea:

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

oRebar:nTop = 60 // esta !!!

Puedes ponerla en la posición que desees :-)

Re: Position Toolbar

Posted: Tue Aug 05, 2014 11:55 am
by ctoas
Tanks Antonio