To Nages: Proposal for implementation

To Nages: Proposal for implementation

Postby Silvio.Falconi » Sun May 12, 2013 8:50 am

On Delphi Browse ( Like xbrowse) I saw there is the possibility to show a buttonBar on the topo of Browse, With some utilities and navigation commands, it can be activate from user or not on window and on dialog
When the user wish show the buttonbar the browse change the initial sizes :

I show you the features :

When I open the browse I can select to show or to not show the buttonbar

Image


I f I select to not show the buttonbat it calculate the resize of xbrowse

Image




I wish to implement this but I not Know How make it

I made a test
Code: Select all  Expand view


#include 'fivewin.ch'
#include 'xbrowse.ch'


static lToolbar:=.f.

function Main()

   local oDlg, oBrw, oFont

   SET DATE ITALIAN
   SET CENTURY ON

   FwNumFormat( 'E', .t. )


   USE C:\WORK\FWH\SAMPLES\CUSTOMER  ALIAS CUST


   DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -14

   DEFINE DIALOG oDlg SIZE 640,440 PIXEL ;
      FONT oFont TITLE 'XBrowse Change Size'


   @ 10,20 XBROWSE oBrw OF oDlg SIZE -10,-20 PIXEL ;
      COLUMNS "First", "State", "Age", "HireDate", "Salary" ;
      ALIAS 'CUST' NOBORDER

   oBrw:lRecordSelector := .f.
   oBrw:nMarqueeStyle   := MARQSTYLE_HIGHLWIN7

   oBrw:bRCLicked := {|nRow,nCol| MenuOption(oDlg,nRow,nCol,"CUST",oBrw) }


   oBrw:CreateFromCode()

   ACTIVATE DIALOG oDlg CENTERED

   RELEASE FONT oFont

return nil






Function MenuOption(oDlg,nRow,nCol,cDbf,oGrid)
LOCAL oMenu

MENU oMenu POPUP 2007
           SEPARATOR
           MENUITEM "Show ToolBar" ACTION (ChangeSize(oGrid,ltoolBar),oGrid:refresh())
           SEPARATOR

          ENDMENU


          ACTIVATE POPUP oMenu OF oDlg AT  oGrid:nTop+nRow, oGrid:nLeft+nCol


RETURN (NIL)






Function ChangeSize(oGrid,ltoolBar)

nOldTop:= oGrid:ntop
nOldBottom:=oGrid:nBottom

    If ltoolBar
         CreateToolBar( oGrid,oDlg,ltoolBar)
         oGrid:nTop:= nOldTop -40
         oGrid:nHeight:=oGrid:nBottom -40
       Else
         oGrid:nTop:=nOldTop +40
         oGrid:nHeight:=oGrid:nBottom +40

    Endif
Retur nil







Function CreateToolBar( oGrid,oDlg,ltoolBar)
   Local oExit
   If ltoolBar
DEFINE BUTTONBAR oBar  SIZE 40, 46 OF oDlg  2007
 oBar:bRClicked := { || .t. }


  DEFINE BUTTON OF oBar ;
      RESOURCE "RB_CLIENTI"       ;
      TOOLTIP i18n( "Gestión de documentos" ) ;
      MESSAGE i18n( "Gestión de del fichero de documentos." ) ;
      ACTION NIL  ;
      NOBORDER


   DEFINE BUTTON oExit OF oBar  ;
      RESOURCE "BB_EXIT"      ;
      TOOLTIP i18n( "Salir del programa" ) ;
      MESSAGE i18n( "Finalizar el uso del programa." ) ;
      ACTION odlg:End()  ;
      GROUP NOBORDER



ELSE

   If oBar!=NIL
      oBar:End()
   Endif

ENDIF


     oDlg:refresh()

return nil
 
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: To Nages: Proposal for implementation

Postby Silvio.Falconi » Mon May 13, 2013 7:53 am

I made another test

It run ok - I wish implement this directly on Xbrowse as a class or methods



Code: Select all  Expand view


#include 'fivewin.ch'
#include 'xbrowse.ch'


static lToolbar:=.t.
static oDlg, oBrw, oFont,oBar

function Main()



   SET DATE ITALIAN
   SET CENTURY ON

   FwNumFormat( 'E', .t. )


   USE C:\WORK\FWH\SAMPLES\CUSTOMER  ALIAS CUST


   DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -14

   DEFINE DIALOG oDlg SIZE 640,440 PIXEL ;
      FONT oFont TITLE 'XBrowse Change Size'


   @ 10,20 XBROWSE oBrw OF oDlg SIZE -10,-20 PIXEL ;
      COLUMNS "First", "State", "Age", "HireDate", "Salary" ;
      ALIAS 'CUST' NOBORDER

   oBrw:lRecordSelector := .f.
   oBrw:nMarqueeStyle   := MARQSTYLE_HIGHLWIN7

   oBrw:bRCLicked := {|nRow,nCol| MenuOption(oDlg,nRow,nCol,"CUST",oBrw) }


   oBrw:CreateFromCode()

   ACTIVATE DIALOG oDlg CENTERED ;
               ON INIT ChangeSize( oBrw,ltoolBar)

   RELEASE FONT oFont

return nil






Function MenuOption(oDlg,nRow,nCol,cDbf,oGrid)
LOCAL oMenu

MENU oMenu POPUP 2007
           SEPARATOR
           MENUITEM "Show ToolBar";
           WHEN { |o| o:SetCheck( ltoolBar ), .t. } ;
           ACTION ( ltoolBar :=!ltoolBar,;
                   ChangeSize(oGrid,ltoolBar,oBar),oGrid:refresh(),;
                   oMenuItem:SetCheck( ltoolBar ))
           SEPARATOR

          ENDMENU


          ACTIVATE POPUP oMenu OF oDlg AT  oGrid:nTop+nRow, oGrid:nLeft+nCol


RETURN (NIL)






Function ChangeSize(oGrid,ltoolBar,oBar)

nOldTop:= oGrid:ntop
nOldBottom:=oGrid:nBottom

    If ltoolBar
         CreateToolBar( oGrid,oDlg,ltoolBar)
         oGrid:nTop:= nOldTop +40
         oGrid:nHeight:=oGrid:nBottom+40
      Else

          If oBar!=NIL
            oBar:End()
           Endif

         oGrid:nTop:=nOldTop -40
         oGrid:nHeight:=oGrid:nBottom -40

      Endif

      oGrid:refresh()
Retur nil







Function CreateToolBar( oGrid,oDlg,ltoolBar)
   Local oExit

   local nClrText := CLR_BLACK

   * oFont = TFont():New( GetDefaultFontName(), 0, GetDefaultFontHeight(),, )

   If ltoolBar

   DEFINE BUTTONBAR oBar _3D SIZE 33, 33 OFoDlg


        ELSE

   If oBar!=NIL
      oBar:End()
   Endif

    ENDIF




     oDlg:refresh()

return nil





 
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: To Nages: Proposal for implementation

Postby Silvio.Falconi » Mon May 13, 2013 8:24 am

For First We must create a Class to create a control Like buttonBar to insert on the top of the xbrowse because buttonbar or toolbar can be create in the dialog or on the wnd and not on top of the object xbrowse

So, I thinked to create this

Function CreateToolBar( oGrid,oDlg,ltoolBar)
Local oExit,oItem1
local nClrText := CLR_BLACK
Local nHeightBar:=20
If ltoolBar
oBar := TMyControl():New( oGrid:nTop+(nHeightBar-2),oGrid:nLeft, oDlg, , CLR_RED, RGB( 191, 219, 255 ), .t., , oGrid:nwidth, nHeightBar,, )
ELSE
If oBar!=NIL
oBar:End()
Endif
ENDIF
oDlg:refresh()
return nil


TMyControl class I copied TMyControl Antonio's class sample from Plantillas section of this forum
Code: Select all  Expand view



 //----------------------------------------------------------------------------//

    CLASS TMyControl FROM TControl

       CLASSDATA lRegistered AS LOGICAL

       METHOD New( nTop, nLeft, oWnd, nPos, nClrFore,;
                   nClrBack, lPixel, lDesign, nWidth, nHeight,;
                   cMsg, lVertical ) CONSTRUCTOR

       METHOD ReDefine( nId, oWnd ) CONSTRUCTOR

    ENDCLASS

    //----------------------------------------------------------------------------//

    METHOD New( nTop, nLeft, oWnd, nPos, nClrFore, nClrBack, lPixel,;
                lDesign, nWidth, nHeight, cMsg, lVertical ) CLASS TMyControl

       DEFAULT nTop     := 0, nLeft := 0,;
               oWnd     := GetWndDefault(),;
               nClrFore := oWnd:nClrText,;
               nClrBack := GetSysColor( COLOR_BTNFACE ),;
               lPixel   := .f.,;
               lDesign  := .f.,;
               nWidth   := 200, nHeight := 21,;
               lVertical := .f.

       ::nStyle    = nOR( WS_CHILD, WS_VISIBLE, WS_TABSTOP )
       ::nId       = ::GetNewId()
       ::oWnd      = oWnd
       ::cMsg      = cMsg
       ::nTop      = If( lPixel, nTop, nTop * SAY_CHARPIX_H )
       ::nLeft     = If( lPixel, nLeft, nLeft * SAY_CHARPIX_W )
       ::nBottom   = ::nTop + nHeight - 1
       ::nRight    = ::nLeft + nWidth - 1
       ::lDrag     = lDesign
       ::lCaptured = .f.
       ::nClrText  = nClrFore
       ::nClrPane  = nClrBack

       ::Register()

       if ! Empty( oWnd:hWnd )
          ::Create()
          ::Default()
          oWnd:AddControl( Self )
       else
          oWnd:DefControl( Self )
       endif

       if lDesign
          ::CheckDots()
       endif

    return Self

    //----------------------------------------------------------------------------//

    METHOD ReDefine( nId, oWnd ) CLASS TMyControl

       DEFAULT oWnd := GetWndDefault()

       ::nId  = nId
       ::oWnd = oWnd

       ::Register()

       oWnd:DefControl( Self )

    return Self

    //----------------------------------------------------------------------------//


 




this is the result but we must create the possibility to insert buttons

Image
Last edited by Silvio.Falconi on Mon May 13, 2013 8:48 am, edited 1 time in total.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: To Nages: Proposal for implementation

Postby Silvio.Falconi » Mon May 13, 2013 8:46 am

I insert another method METHOD AddItem(cPrompt, bAction, cBitmap)


Image



[code]
METHOD AddItem(cPrompt, bAction, cBitmap) CLASS TMyControl
local oItem
local nPos


oItem =TBtnBmp():New( 1, 1,, ::nHeight-4,,, cBitmap, cBitmap,bAction, self, cPrompt )


* AAdd( ::aItems, oItem )

return nil[code]
Last edited by Silvio.Falconi on Mon May 13, 2013 9:23 am, edited 2 times in total.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: To Nages: Proposal for implementation

Postby Antonio Linares » Mon May 13, 2013 9:17 am

Silvio,

We can have any control on top of a browse, or at its sides, no limits...

Thats why I see no reason to implement what you described. Why should we behave like that ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42092
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: To Nages: Proposal for implementation

Postby Silvio.Falconi » Mon May 13, 2013 9:24 am

Antonio, cannot we create buttonbar or toolbar on top of xbrowse ?
can make a tet sample please?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: To Nages: Proposal for implementation

Postby Silvio.Falconi » Mon May 13, 2013 9:32 am

Antonio,
Sorry....I saw now we can !!!

oBar:= TBar():New(oDlg)
oBar:ntop := oGrid:nTop+(nHeightBar-2)
oBar:nLeft:= oGrid:nLeft
oBar:nwidth :=oGrid:nwidth
oBar:nbottom:= nHeightBar


ok we have resolve this!!
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: To Nages: Proposal for implementation

Postby Silvio.Falconi » Mon May 13, 2013 9:42 am

Image

oBar:= TBar():New(oDlg)
oBar:ntop := oGrid:nTop+8
oBar:nLeft:= oGrid:nLeft
oBar:nwidth :=oGrid:nwidth
oBar:nbottom:= nHeightBar
oBar:l2010 :=.t.
oBar:l3D :=.t.
oBar:nMode :=1




Antonio,
Good ...but how I can to erase Black border of Bar?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: To Nages: Proposal for implementation

Postby James Bott » Mon May 13, 2013 3:50 pm

Silvio,

For First We must create a Class to create a control Like buttonBar to insert on the top of the xbrowse because buttonbar or toolbar can be create in the dialog or on the wnd and not on top of the object xbrowse


Why does it matter? It looks the same and works the same, so what difference does it make?

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: To Nages: Proposal for implementation

Postby Silvio.Falconi » Mon May 13, 2013 4:40 pm

the matter.. was... I thinked it cannot be made but now I tried and I can insert a buttonbar on top of xbrowse

the new matter is I cannot insert a toolBar on the top of the xbrowse as a buttonbar or you have a idea ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: To Nages: Proposal for implementation

Postby James Bott » Mon May 13, 2013 6:11 pm

>the matter.. was... I thinked it cannot be made but now I tried and I can insert a buttonbar on top of xbrowse

What do you mean by "top of xBrowse." How is this different from putting a buttonbar at the top of the window which also contains the browse?

>the new matter is I cannot insert a toolBar on the top of the xbrowse as a buttonbar or you have a idea ?

I don't understand. Are you saying a toolbar is different than a buttonbar?

You can put a buttonbar at the top of a window, dialog, or panel and put the browse under it. That should work for whatever you are trying to do.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: To Nages: Proposal for implementation

Postby Silvio.Falconi » Mon May 13, 2013 7:29 pm

I understood you not understood

On a Italian application made with Delphi, I saw a Grid as xbrowse ( please see the first message of this topic)

this grid have a toolbar on top ( navigation and other utilities)

the user can select a menupop up to hide or show the toolbar

I thinked it made as you understood ... a toolbar on the dialog on top or on bottom of the dialog

but then I understood it not made in this easy types because I saw on the same application a procedure where I can see a grid with the same toolbar on different position of the dialog :



On a folder


Image




on Middle position on the dialog, after some other controls


Image



So, I thinked , it perhaps was made on the top of xbrowse


So, I tried before with a buttonbar , then with toolbar

while I can set the position of buttonbar in any position of the dialog ... I cannot made it with toolbar !!!!

I hope you understood my problem now

How I can make it with fwh ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: To Nages: Proposal for implementation

Postby James Bott » Mon May 13, 2013 8:11 pm

So, I tried before with a buttonbar , then with toolbar
while I can set the position of buttonbar in any position of the dialog ... I cannot made it with toolbar !!!!


Sorry, I didn't know until now there was a new control called "toolbar." I thought you were talking about the original buttonbar.

How is the toolbar different from the buttonbar?

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: To Nages: Proposal for implementation

Postby Silvio.Falconi » Tue May 14, 2013 6:59 am

yes,
I believe ToolBar is more good than buttonbar
the problem is I not Know how create toolbar at x,y

to make a toolbar you must create before the imagelist ( a type of library of all images of buttons)

then you can create your toolbar

a small test
#define LIGHTCYAN nRGB( 203, 225, 252 )

function Main()
....DEFINE DIALOG..oDlgLook.

nColore_ToolBar := LIGHTCYAN
Create_ImageList(nColore_ToolBar)

....ACTIVATE DIALOG oDlgLook CENTER;
ON INIT BtnBarLook(oImageList)
RETUR NIL

//---------------------------------------------------------------------------------//
Function Create_ImageList(nColore_ToolBar)

DEFINE IMAGELIST oImageList SIZE 16,16
oImageList:AddMasked( TBitmap():Define( "LOOK_TOP",, oDlgLook ), nColore_ToolBar )
oImageList:AddMasked( TBitmap():Define( "LOOK_PREV",, oDlgLook ), nColore_ToolBar )
oImageList:AddMasked( TBitmap():Define( "LOOK_NEXT",, oDlgLook ), nColore_ToolBar )
oImageList:AddMasked( TBitmap():Define( "LOOK_BOTTOM",, oDlgLook ), nColore_ToolBar )
RETURN oImageList
//--------------------------------------------------------------------------------------//


Function BtnBarLook(oImageList)

oReBar := TReBar():New( oDlgLook )

DEFINE TOOLBAR oBar OF oReBar SIZE 22,22 IMAGELIST oImageList

DEFINE TBBUTTON OF oBar ;
ACTION oBrwLook:KeyDown(VK_HOME, 0) ;
TOOLTIP i18n( "Primo record" ) ;
MESSAGE i18n( "Primo record dell'elenco." )


.....

RETURN NIL
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: To Nages: Proposal for implementation

Postby James Bott » Tue May 14, 2013 6:52 pm

Silvio,

I am still not clear what you want to do. Do you want to be able to allow the user to show and hide the toolbar? If so,

oWnd:oTop:= oToolbar
oWnd:oClient:= oBrowse
ACTIVATE WINDOW oWnd

Then to hide the toolbar:
oWnd:oTop:=nil
oWnd:resize()

Or to show the toolbar
oWin:oTop:= oToolbar
oWnd:resize()

Not tested, but I think that will work.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 72 guests