Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Command Bars + FoxPro9
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Command Bars + FoxPro9

 Post Reply Post Reply
Author
Message
gabrielfast View Drop Down
Newbie
Newbie


Joined: 19 May 2009
Location: Brazil
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote gabrielfast Quote  Post ReplyReply Direct Link To This Post Topic: Command Bars + FoxPro9
    Posted: 19 May 2009 at 10:18am
Hello,

The CommandBars works in FoxPro9 ?
How do I leave the menu with FoxPro Ribbon?

Thanks
Back to Top
wlcabral View Drop Down
Groupie
Groupie
Avatar

Joined: 25 April 2007
Location: Brazil
Status: Offline
Points: 72
Post Options Post Options   Thanks (0) Thanks(0)   Quote wlcabral Quote  Post ReplyReply Direct Link To This Post Posted: 26 May 2009 at 9:45pm
Yes, works fine !     (CommandBars, ReportControl, CalendarControl and many others)
 
Just add the OLE object (xtremeCommandbar)  in your form and start to change the properties (there are many)  :
 
"thisform.olecontrol1.OBJECT.AnyProperty = AnyValidValue".    
 
There are no help for VFP, so you'll need to spend a lot of time to learn all possibilities...
 
 
 
 
 
wlcabral
Back to Top
DDTech View Drop Down
Groupie
Groupie


Joined: 10 October 2007
Status: Offline
Points: 23
Post Options Post Options   Thanks (0) Thanks(0)   Quote DDTech Quote  Post ReplyReply Direct Link To This Post Posted: 30 May 2009 at 7:22am

Commandbars work perfectly well with VFP9. I am actually thinking about writing tutorials on that topic, but had no time yet.

If You need any help, just contact me or probably better lets communicate via this forum so others can participate.

One thing You should NOT do is to drop the control on Your form and work with this. It works perfectly well, but CodeJock's controls get new component-IDs with every release. Therefore, if You use the ActiveX-Control directly You will stick to the version You once built Your form with. This has pros and cons as most things in life.

So, what You should do is inherit the control once You get a new version and work with that. Also You should add the CommandBars via code as VFP includes the OLE-Code in the form which hampers changes made to the class from getting down to the form - this is so for all ActiveX-Controls.

Create a new Classlib and add one single class to it, the CommandBar-Class, giving it a name that counts for all versions. Mine is called "aCJToolbar" (abstract class CodeJock Toolbar). Don't change anything, simply save it.

all Your applcation specific toolbars (commandbars) now will inherit from this aCJToolbar. So whenever CodeJock comes out with a new version, throw the old Classlib with aCJToolbar away, create a new one with the new Component and You're done.


You can now either use aCJToolbar directly or inherit from that.

I prefer to subclass it in code and add application specific code to it. For that purpose I have a "base" class I build all my application-specific code-Jock-classes on.

There is ResizeClient(), an event that is highly useful for us VFP-guys, as it allows resizing our controls according to the position and react to docking and undocking. Only CodeJocks commandbars allow us to do this. I have been working with other toolbars and most of them are designed for VB and simply cover the whole form if You don't do magic and tricks. (ActiveBar worked until they changed to version 2. I made it work with Version 2 too but it has been a pain in the a... ).. .anyway this ResizeClient() fires whenever You even think of touching the toolbar. As you don't want unneccessary re-arranging of Your controls, You might like something like this:



DEFINE CLASS cCJToolbar as aCJToolbar of CJToolbar.vcx
    _ClientArea = .NULL.

    PROCEDURE ResizeClient(tnLeft as Integer, tnTop as Integer, tnRight as Integer, tnBottom as Integer)
        *================================================================*
        *  ResizeClient wird bei jeder Bewegung der Toolbars ausgeführt  *
        *  auch, wenn die Größe der ClientArea sich nicht ändert.        *
        *  Daher hier intern die Area festhalten und mit der neuen       *
        *  Änderung vergleichen.                                         *
        *  Ändert sich etwas am Layout, dann DoResizeClient aufrufen     *
        *================================================================*
       
        DEBUGOUT "ResizeClient", tnLeft, tnTop, tnRight, tnBottom
       
        if ! isNULL(this._oClientArea) ;
          and tnLeft    = this._oClientArea.Left;
          and tnTop     = this._oClientArea.Top;
          and tnRight     = this._oClientArea.Right;
          and tnBottom     = this._oClientArea.Bottom
            *-- nothing 
        else
            if isNull(this._oClientArea)
                this._oClientArea = create("EMPTY")
                addProperty(this._oClientArea, "Left", tnLeft)
                addProperty(this._oClientArea, "Top", tnTop)
                addProperty(this._oClientArea, "Right", tnRight)
                addProperty(this._oClientArea, "Bottom", tnBottom)
               
            else
                this._oClientArea.Left    = tnLeft
                this._oClientArea.Top    = tnTop
                this._oClientArea.Right    = tnRight
                this._oClientArea.Bottom= tnBottom
               
            endif
            this.DoResizeClient(tnLeft, tnTop, tnRight, tnBottom)
        endif
       
    ENDPROC

    PROCEDURE DoResizeClient(tnLeft as Integer, tnTop as Integer, tnRight as Integer, tnBottom as Integer)
        *-- Hook
    ENDPROC

ENDDEFINE


Add a transparent Container to Your form and put all of Your Controls into that Container (mine is called "ClientArea"). Anchor all Your controls to that Container and You're allmost done.


in the form's INIT You instantiate the Toolbar and load the configuration (create your toolbar with the designer and save the XCB file

PROCEDURE INIT

...

    _vfp.AutoYield = .F.  && this is important

    if ! pemStatus(this,"TB",5)
        this.NewObject("TB", "cCJToolbar", "CJToolbar_Schedule.FXP")
    endif

    this.TB_oClientArea = .NULL.
 
    *-- load configuration and design into the Commandbars
    this.TB.LoadDesignerBars("TEMP\PP_SCHEDULE01.XCB")

    *-- bind to resizing and dock/undock events.
    bindEvent(this.TB, "DoResizeClient", this, "ONResizeClient", 1)
   
    ....

ENDPROC

PROCEDURE ONResizeClient
    lparameters    tnLeft, tnTop, tnRight, tnBottom

    DEBUGOUT "OnResizeClient",tnLeft, tnTop, tnRight, tnBottom

    this.ClientArea.Move( tnLeft, tnTop, tnRight-tnLeft, tnBottom-tnTop)

ENDPROC



 
Hope that helps as a startup.


regards

Frank







Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.133 seconds.