Page 1 of 1

How to update DCTOOLBAR at runtime

Posted: Fri Feb 01, 2013 10:35 am
by jdsoft
Hello,
My main app window has a tool bar.

Code: Select all

LOCAL nBtnSize := 40
LOCAL nBtwSpace := 1
LOCAL oStatTop := nil
LOCAL oTool := nil
DCSTATUSBAR oStatTop WIDTH nBtnSize HEIGHT nBtnSize ALIGN DCGUI_ALIGN_TOP TYPE XBPSTATIC_TYPE_TEXT EVAL  {|o|o:SetColorBg(GRA_CLR_WHITE),o:SetColorFg(GRA_CLR_WHITE)}
@ 0,0   DCTOOLBAR oTool ALIGN TOOLBAR_TOP PIXEL BUTTONSIZE nBtnSize,nBtnSize SIZE (((nBtnSize + nBtnSpace) * 14)),nBtnSize FANCY EVAL {|o|o:SetColorBg(GRA_CLR_WHITE),o:SetColorFg(GRA_CLR_WHITE)} PARENT oStatTop
DCSETPARENT TO oTool
DCADDBUTTON TYPE    XBPSTATIC_TYPE_TEXT       SIZE nBtnSpace,nBtnSize
DCADDBUTTON CAPTION ICON_ABC_ADM              ACTION {|| _StartBlock({||ReStartAdmin()})}    TOOLTIP  'Een andere administratie openen'
DCADDBUTTON CAPTION ICON_BROWSE               ACTION {|| _StartBlock({||Browse_Data()})}     TOOLTIP  'Bekijken data'
DCADDBUTTON CAPTION ICON_INBOEKEN_ING      ACTION {|| _StartBlock({||Start_Inboeken_Ing()})} TOOLTIP  'Inboeken ING'
DCADDBUTTON CAPTION ICON_INBOEKEN_RABO    ACTION {|| _StartBlock({||Start_Inboeken_Rabo()})} TOOLTIP  'Inboeken Rabo'
etc.
Now, at runtime i would like to rebuild the toolbar buttons, without destroying the getlist on my main window.
- Removing buttons from the toolbar
- Adding buttons to the toolbar
How can i do this?
Regards,
Jack Duijf

Re: How to update DCTOOLBAR at runtime

Posted: Fri Feb 01, 2013 11:46 am
by rdonnay
Jack -

Look at the \exp19\samples\shortcuts\shortcuts.prg sample program.

This lets you drop buttons onto a toolbar.

Roger