bb.donnay-software.com
http://bb.donnay-software.com/Donnay/

Redawing of a commadnBar
http://bb.donnay-software.com/Donnay/viewtopic.php?f=5&t=386
Page 1 of 1

Author:  edv-rudrich [ Mon Jan 17, 2011 11:29 am ]
Post subject:  Redawing of a commadnBar

Hi..

it#s a little frustrating to try to look behind the architecture of XCodeJock--

I need to change captions and group titles of a commandbar object on-the-fly..

CJAddControl does not allow the use of a codeblock as a caption, so I tried
to use variables instead and try to redraw the complete commandbar with
oCommanBar:RedrawBar()

This fails and error log says. Unknown method for this object..
Documentation of CodeJock says that there IS a method called Redrawbar..

Any help?

- Michael

Author:  Tom [ Mon Jan 17, 2011 12:08 pm ]
Post subject:  Re: Redawing of a commadnBar

Check your mail. ;)

Author:  rdonnay [ Mon Jan 17, 2011 4:28 pm ]
Post subject:  Re: Redawing of a commadnBar

Tom -

Michael sent me a private email about this, but I didn't have a quick answer because I have spent so little time with Commandbars.

Thank you for doing my support for me again.

I'm down on the US/Mexico border this week, getting a lot more dental work done, so my wits are not with me at the moment. I had a root canal today and another on Wednesday. I'm glad I brought wine with me.

The temp here today is 85 degrees F.

Roger

Author:  edv-rudrich [ Tue Jan 18, 2011 12:55 am ]
Post subject:  Re: Redawing of a commadnBar

Roger -

I wonder why the Method RedrawBar() crashes.. this should be a method
of the commandbar object like the documentation says..

- Michael

Author:  Tom [ Tue Jan 18, 2011 4:56 am ]
Post subject:  Re: Redawing of a commadnBar

Here's some code based on the sample from Chris which works. Calling a menu entry sets the caption of the SLE. Remember to change the version # of CJ.

Code:
///////////////////////////////////////////////////////////////////////////////
//
//  Ribbonbar with Xbase++ and eXPress++
//  Creation date: 12/12/2008
//  Chris Andries - ABO service bvba - Belgium
//
///////////////////////////////////////////////////////////////////////////////

#include "Gra.ch"
#include "Xbp.ch"
#include "Appevent.ch"
#include "Font.ch"
#INCLUDE "dcdialog.CH"
#INCLUDE "commandbars.CH"

//define CommandbarCLSID '{D59F55F6-5C22-4C23-80D6-FED9AD149F2C}'
#define CommandbarCLSID 'Codejock.CommandBars.13.4.0'


PROC appsys ; RETURN

function Main()

LOCAL Getlist[0], Getoptions,  oCommandBar, oStatic, oRibbon, oSearchGroup

@ -1,0 DCACTIVEXCONTROL oCommandbar SIZE 50, 10  ;
      CLSID CommandbarCLSID ;
      EVAL {|o| o:visualtheme := 2, ;
                o:add("commandbar",xtpBarTop) ,;
                ;// o:caption := 'Ribbon Bar Sample', ;
                o:execute := {|o|_execute(o,oStatic,oRibbon,oSearchGroup)}, ;
                _StartRibbon(o,@oRibbon,@oSearchGroup)};
      RESIZE DCGUI_RESIZE_REPOSONLY_Y

@ 9,0 DCSAY '' OBJECT oStatic COLOR GRA_CLR_RED, GRA_CLR_WHITE ;
      SIZE 50, 10 FONT '24.Arial Bold' SAYWORDBREAK ;
      RESIZE DCGUI_RESIZE_RESIZEONLY

DCGETOPTIONS RESIZE

DCREAD GUI TITLE 'CodeJock Command Bar' OPTIONS GetOptions FIT

RETURN nil

* -----------

STATIC FUNCTION _StartRibbon(o,oRibbonBar,oSearchGroup)

Local oControl, oPopUp, oTab1, oTab2, oControlFile

oRibbonBar := o:AddRibbonBar("Ribbonbar1")
oRibbonBar:enableDocking(xtpFlagStretched)

oControlFile := oRibbonBar:AddSystemButton()
oControlFile:IconId := 0
oControlFile:Caption := "&File"
oControlFile:CommandBar:Controls:Add( xtpControlButton, 10, "&New" )
oControlFile:CommandBar:Controls:Add( xtpControlButton, 11, "&Open..." )
oControlFile:CommandBar:Controls:Add( xtpControlButton, 12, "&Save" )
oControlFile:CommandBar:Controls:Add( xtpControlButton, 13, "Save &As..." )

oControl := oRibbonBar:Controls:Add(xtpControlPopup, -1, "&Popup ONE", 1)

oPopUp := oControl:CommandBar:Controls
oPopUp:Add(xtpControlButton, 1, "&Nieuw")
oPopUp:Add(xtpControlButton, 2, "&Edit")

oControl := oPopUP:Add(xtpControlButton, 3, "&Save")
oControl:BeginGroup := .T.

oTab1 := oRibbonBar:InsertTab(0, "&Write")
oTab2 := oRibbonBar:InsertTab(0, "&Read")
oGroup := oTab1:Groups:AddGroup("Group",50)
oSearchGroup := oGroup:Add(xtpControlEdit, 51, "Search:")
oSearchGroup:EditHint := "Enter here..."
oSearchGroup:Width := 100
oSearchGroup:TextLimit := 20
oSearchGroup:Text := Space(20)
oSearchGroup:Enabled := .T.
oSearchGroup:SetProperty("ReadOnly",.F.)

return nil

* ------------

STATIC FUNCTION _execute( oPopup, oStatic, oRibbon,oSearchGroup )

LOCAL cMessage

IF oPopup:id == 1
  cMessage := 'Nieuw from Popup'
ELSEIF oPopup:id == 2
  cMessage := 'Edit from Popup'
ELSEIF oPopup:id == 3
  cMessage := 'Save from Popup'
ELSEIF oPopup:id == 10
  cMessage := 'New from System Menu'
ELSEIF oPopup:id == 11
  cMessage := 'Open from System Menu'
ELSEIF oPopup:id == 12
  cMessage := 'Save from System Menu'
ELSEIF oPopup:id == 13
  cMessage := 'SaveAs from System Menu'
ENDIF

IF !Empty(cMessage) .AND. Valtype(oStatic) == 'O'
  oStatic:setCaption('You selected: ' + cMessage)
  oSearchGroup:Caption := cMessage
  oRibbon:RedrawBar()
  oRibbon:RecalcLayout()
ENDIF

RETURN nil

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/