Codejock RibbonBar first tests
- richard-service
- Posts: 583
- Joined: Tue Oct 16, 2007 8:57 am
- Location: New Taipei City, Taiwan
- Contact:
Re: Codejock RibbonBar first tests
Hi Antonio,
I post my last paste picture below source code.
Thanks post my code.
Regards,
Richard
I post my last paste picture below source code.
Thanks post my code.
Regards,
Richard
Regards,
Richard
Harbour 3.2.0dev (r1904111533)/xHarbour 1.2.3 Intl. (SimpLex) (Build 20180818) => Borland C++ v7.4
xHarbour 0.99.71 (SimpLex) => Borland C++ v5.5
MySQL v5.7 /ADS v12
Harbour 3.2.0dev (r1603181642) => Borland C++ v7.4 64bit
Richard
Harbour 3.2.0dev (r1904111533)/xHarbour 1.2.3 Intl. (SimpLex) (Build 20180818) => Borland C++ v7.4
xHarbour 0.99.71 (SimpLex) => Borland C++ v5.5
MySQL v5.7 /ADS v12
Harbour 3.2.0dev (r1603181642) => Borland C++ v7.4 64bit
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Codejock RibbonBar first tests
Richard,
Ok, thanks
Ok, thanks
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Codejock RibbonBar first tests
A very early Visual RibbonBar designer prototype. The idea is to interactively desing the RibbonBar and than its source code could be automatically generated:
RibonBar.prg
RibonBar.prg
Code: Select all
#include "FiveWin.ch"
static oRb
function Main()
local oWnd, oAct, oMenu, aControls := {}
DEFINE WINDOW oWnd TITLE "Visual RibbonBar"
@ 0, 0 ACTIVEX oAct PROGID "Codejock.CommandBarsFrame.12.1.1" OF oWnd SIZE 0, 0
oAct:bOnEvent = { | cEvent, aParams, pParams | RibbonBarEvent( cEvent, aParams, pParams, aControls ) }
oAct:Do( "AttachToWindow", oWnd:hWnd )
oRb = oAct:Do( "AddRibbonBar", "fwh" )
oMenu = oRb:Controls:Add( 2, 0, "Menu" )
oMenu:Flags = 1 && xtpFlagRightAlign
oTabs = oMenu:CommandBar:Controls:Add( 2, 0, "Tabs" )
AAdd( aControls, oTabs:CommandBar:Controls:Add( 1, 3000, "Add" ) )
oGroups = oMenu:CommandBar:Controls:Add( 3, 0, "Groups" )
AAdd( aControls, oGroups:CommandBar:Controls:Add( 1, 4000, "Add" ) )
ACTIVATE WINDOW oWnd
return nil
function RibbonBarEvent( cEvent, aParams, pParams, aControls )
local oTab
static nTab := 1, nGroup := 1
do case
case cEvent == "Execute" .and. Len( aControls ) > 0
do case
case aControls[ 1 ]:hObj == aParams[ 1 ]
oTab = oRb:InsertTab( nTab, "Tab " + AllTrim( Str( nTab++ ) ) )
oTab:Selected = .T.
case aControls[ 2 ]:hObj == aParams[ 1 ]
MsgInfo( "Insert Group" )
endcase
endcase
return nil
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Codejock RibbonBar first tests
Visual RibbonBar: Dynamically adding tabs and groups
RibbonBar.prg
RibbonBar.prg
Code: Select all
#include "FiveWin.ch"
static oRb
function Main()
local oWnd, oAct, oMenu, aControls := {}
DEFINE WINDOW oWnd TITLE "Visual RibbonBar"
@ 0, 0 ACTIVEX oAct PROGID "Codejock.CommandBarsFrame.12.1.1" OF oWnd SIZE 0, 0
oAct:bOnEvent = { | cEvent, aParams, pParams | RibbonBarEvent( cEvent, aParams, pParams, aControls ) }
oAct:Do( "AttachToWindow", oWnd:hWnd )
oRb = oAct:Do( "AddRibbonBar", "fwh" )
oMenu = oRb:Controls:Add( 2, 0, "Menu" )
oMenu:Flags = 1 && xtpFlagRightAlign
oTabs = oMenu:CommandBar:Controls:Add( 2, 0, "Tabs" )
AAdd( aControls, oTabs:CommandBar:Controls:Add( 1, 3000, "Add" ) )
oGroups = oMenu:CommandBar:Controls:Add( 3, 0, "Groups" )
AAdd( aControls, oGroups:CommandBar:Controls:Add( 1, 4000, "Add" ) )
ACTIVATE WINDOW oWnd
return nil
function RibbonBarEvent( cEvent, aParams, pParams, aControls )
local oTab
do case
case cEvent == "Execute" .and. Len( aControls ) > 0
do case
case aControls[ 1 ]:hObj == aParams[ 1 ]
oTab = oRb:InsertTab( oRb:TabCount + 1, "Tab " + AllTrim( Str( oRb:TabCount + 1 ) ) )
oTab:Selected = .T.
case aControls[ 2 ]:hObj == aParams[ 1 ]
if oRb:TabCount > 0
oRb:SelectedTab:Groups:AddGroup( "&Group", Len( oRb:SelectedTab:Groups ) + 1 )
endif
endcase
endcase
return nil
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Codejock RibbonBar first tests
Visual RibbonBar: enhanced version
RibbonBar.prg
RibbonBar.prg
Code: Select all
#include "FiveWin.ch"
static oRb
function Main()
local oWnd, oAct, oMenu, aControls := {}
DEFINE WINDOW oWnd TITLE "Visual RibbonBar"
@ 0, 0 ACTIVEX oAct PROGID "Codejock.CommandBarsFrame.12.1.1" OF oWnd SIZE 0, 0
oAct:bOnEvent = { | cEvent, aParams, pParams | RibbonBarEvent( cEvent, aParams, pParams, aControls ) }
oAct:Do( "AttachToWindow", oWnd:hWnd )
oRb = oAct:Do( "AddRibbonBar", "fwh" )
oMenu = oRb:Controls:Add( 2, 0, "Menu" )
oMenu:Flags = 1 && xtpFlagRightAlign
oTabs = oMenu:CommandBar:Controls:Add( 2, 0, "Tabs" )
AAdd( aControls, oTabs:CommandBar:Controls:Add( 1, 3000, "Add" ) )
oGroups = oMenu:CommandBar:Controls:Add( 3, 0, "Groups" )
AAdd( aControls, oGroups:CommandBar:Controls:Add( 1, 4000, "Add" ) )
ACTIVATE WINDOW oWnd
return nil
function RibbonBarEvent( cEvent, aParams, pParams, aControls )
local oTab
do case
case cEvent == "Execute" .and. Len( aControls ) > 0
do case
case aControls[ 1 ]:hObj == aParams[ 1 ]
oTab = oRb:InsertTab( oRb:TabCount + 1, "Tab " + AllTrim( Str( oRb:TabCount + 1 ) ) )
oTab:Selected = .T.
case aControls[ 2 ]:hObj == aParams[ 1 ]
if oRb:TabCount > 0
oRb:SelectedTab:Groups:AddGroup( "Group " + AllTrim( Str( oRb:SelectedTab:Groups:GroupCount + 1 ) ),;
oRb:SelectedTab:Groups:GroupCount + 1 )
endif
endcase
endcase
return nil
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Codejock RibbonBar first tests
Visual RibbonBar: adding controls (buttons), developed together with Daniel
RibonBar.prg
RibonBar.prg
Code: Select all
#include "FiveWin.ch"
#define xtpControlButton 1
static oRb
function Main()
local oWnd, oAct, oMenu, oGroups, oControls, aControls := {}
DEFINE WINDOW oWnd TITLE "Visual RibbonBar"
@ 0, 0 ACTIVEX oAct PROGID "Codejock.CommandBarsFrame.12.1.1" OF oWnd SIZE 0, 0
oAct:bOnEvent = { | cEvent, aParams, pParams | RibbonBarEvent( cEvent, aParams, pParams, aControls ) }
oAct:Do( "AttachToWindow", oWnd:hWnd )
oRb = oAct:Do( "AddRibbonBar", "fwh" )
oMenu = oRb:Controls:Add( 2, 0, "Menu" )
oMenu:Flags = 1 && xtpFlagRightAlign
oTabs = oMenu:CommandBar:Controls:Add( 2, 0, "Tabs" )
AAdd( aControls, oTabs:CommandBar:Controls:Add( 1, 3000, "Add" ) )
oGroups = oMenu:CommandBar:Controls:Add( 3, 0, "Groups" )
AAdd( aControls, oGroups:CommandBar:Controls:Add( 1, 4000, "Add" ) )
oControls = oMenu:CommandBar:Controls:Add( 3, 0, "Controls" )
AAdd( aControls, oControls:CommandBar:Controls:Add( 1, 5000, "Add Button" ) )
ACTIVATE WINDOW oWnd
return nil
function RibbonBarEvent( cEvent, aParams, pParams, aControls )
local oTab, oGroup, oControl
do case
case cEvent == "Execute" .and. Len( aControls ) > 0
do case
case aControls[ 1 ]:hObj == aParams[ 1 ]
oTab = oRb:InsertTab( oRb:TabCount + 1, "Tab " + AllTrim( Str( oRb:TabCount + 1 ) ) )
oTab:Id = oRb:TabCount
oTab:Selected = .T.
case aControls[ 2 ]:hObj == aParams[ 1 ]
if oRb:TabCount > 0
oGroup = oRb:SelectedTab:Groups:AddGroup( "Group " + AllTrim( Str( oRb:SelectedTab:Groups:GroupCount + 1 ) ),;
( oRb:SelectedTab:Index * 10 ) + oRb:SelectedTab:Groups:GroupCount + 1 )
endif
case aControls[ 3 ]:hObj == aParams[ 1 ]
if oRb:SelectedTab:Groups:GroupCount > 0
oGroup = oRb:FindGroup( ( oRb:SelectedTab:Index * 10 ) + oRb:SelectedTab:Groups:GroupCount )
oControl = oGroup:Add( xtpControlButton, 1, nil )
oControl:Caption = "Button " + AllTrim( Str( oGroup:Count ) )
endif
endcase
endcase
return nil
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Codejock RibbonBar first tests
Anser,
I think that first you have to register the ActiveX as an administrator. But not 100% sure about it.
Also, you can check if the ActiveX is available before using it:
I think that first you have to register the ActiveX as an administrator. But not 100% sure about it.
Also, you can check if the ActiveX is available before using it:
Code: Select all
if ! IsActiveX( "Codejock.CommandBars.v13.0.0.ocx" )
MsgStop( "ActiveX missing" )
return nil
endif
Re: Codejock RibbonBar first tests
Dear Mr.Antonio,
Another Problem which I have seen is that IsActivex() is always returning .F.The OCX contorl and my Test.Exe is available in the Same folder
To re-check, I manually registered the OCX Control and run the Test.Exe again, but the fuction IsActivex() is always returning .F.
I can't understand where I have gone wrong ?
Regards
Anser
I am testing the problem in Win XP as Administrator.I think that first you have to register the ActiveX as an administrator. But not 100% sure about it.
Another Problem which I have seen is that IsActivex() is always returning .F.
Code: Select all
If IsActivex("Codejock.CommandBars.v12.1.1.ocx")
MsgInfo("Activex is already Registerd")
else // If not registered then Display the msg and REgister the OCX
MSgInfo("Activex is NOT Registerd, Now it will Register") // This line is getting executed
RegisterServer( "Codejock.CommandBars.v12.1.1.ocx" )
Endif
// After REsgisterServer, IsActivex() should return .T., but it is returning .F.
If IsActivex("Codejock.CommandBars.v12.1.1.ocx")
MSgInfo("Activex is Successful")
else
MSgInfo("Unable to register the Activex") // This line is getting executed
endif
To re-check, I manually registered the OCX Control and run the Test.Exe again, but the fuction IsActivex() is always returning .F.
I can't understand where I have gone wrong ?
Regards
Anser
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Codejock RibbonBar first tests
Anser,
Please call this function CoInitialize() before calling IsActiveX( cProgId ):
Please call this function CoInitialize() before calling IsActiveX( cProgId ):
Code: Select all
#pragma BEGINDUMP
#include <hbapi.h>
unsigned long CoInitialize( void * );
HB_FUNC( COINITIALIZE )
{
hb_retnl( CoInitialize( NULL ) );
}
#pragma ENDDUMP
Re: Codejock RibbonBar first tests
Anser,
perhaps you have the same problem on some machines as I, so here my solution:
What happens: By executing the method 'AttachToWindow', the RibbonBar begins to fire events, so the code block 'RibbonBarEvent' will be executed and failed 'in the line 'case cEvent == "Execute"' with the error '==' because <cEvent> is numerical!
Solution: Put in the following code:
HTH
perhaps you have the same problem on some machines as I, so here my solution:
What happens: By executing the method 'AttachToWindow', the RibbonBar begins to fire events, so the code block 'RibbonBarEvent' will be executed and failed 'in the line 'case cEvent == "Execute"' with the error '==' because <cEvent> is numerical!
Solution: Put in the following code:
Code: Select all
function RibbonBarEvent( cEvent, aParams, pParams, aButtons, oWnd )
IF Valtype( cEvent ) == "N"
DO CASE
CASE cEvent == 1
cEvent := "Execute"
OTHERWISE
cEvent := ""
ENDCASE
ENDIF
Re: Codejock RibbonBar first tests
Fafi,
you can assign a code block to <oact:bOnEvent>. When an event in the RibbonBar occurs, this code block will be executed. If a button was clicked by the user, the variable <cEvent> has 'normally' the value "Execute". All buttons resides in the array <aButtons>, if 'aButtons[ 1 ]:hObj == aParams[ 1 ]' you know which button was pressed!
I really want to know, how Lailton, Richard, or who else has discovered this know how, compliments to them. Perhaps I have to read the Codejack help file more systematically
BTW, sometimes <cEvent> is numerical, if so on your machine, the code crashes the first time (after 'AttachToWindow') your code block is executed!
you can assign a code block to <oact:bOnEvent>. When an event in the RibbonBar occurs, this code block will be executed. If a button was clicked by the user, the variable <cEvent> has 'normally' the value "Execute". All buttons resides in the array <aButtons>, if 'aButtons[ 1 ]:hObj == aParams[ 1 ]' you know which button was pressed!
I really want to know, how Lailton, Richard, or who else has discovered this know how, compliments to them. Perhaps I have to read the Codejack help file more systematically
BTW, sometimes <cEvent> is numerical, if so on your machine, the code crashes the first time (after 'AttachToWindow') your code block is executed!
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Codejock RibbonBar first tests
Frank,
> I really want to know, how Lailton, Richard, or who else has discovered this know how
You can inspect all properties, methods and events from Microsoft Word VBA:
http://forums.fivetechsupport.com/viewt ... 087#p78087
> I really want to know, how Lailton, Richard, or who else has discovered this know how
You can inspect all properties, methods and events from Microsoft Word VBA:
http://forums.fivetechsupport.com/viewt ... 087#p78087
Re: Codejock RibbonBar first tests
Dear Mr. Frank,
I tried your solution but did not work. My app is crashing when it reaches the point
I tried to check the ValType of cEvent, but the application crashes before reaching that point
Dear Mr.Antonio,
As suggested by you I tried CoInitialize() before calling IsActiveX( cProgId ) but still IsActivex() is always returning .F.
I tried a utility named RegDllView, to check whether the OCX is registered, and it shows that the OCX is regsitered in the system. I am using Windows XP SP3
I tested this in 2 other Win XP Pc's and 1 Windows 7 PC.
I even doubt the licence issue as said in this thread http://forums.fivetechsupport.com/viewt ... =3&t=13351
I am looking for a code to pass the licence key when the contols are used in Client PC (when we use the control on a PC where the CodeJock setup.exe is not installed). In the write up it is said that the valid license key should be used on Form Initialiase using the property GlobalSetting:Licence of the CodeJock Control, but the app is crashing before I can access the Property's of the Control at TActivex initialize itself
Thanks & REgards
Anser
I tried your solution but did not work. My app is crashing when it reaches the point
Code: Select all
oAct := TActiveX():New( oWnd, "Codejock.CommandBarsFrame.12.1.1", 0, 0, 0, 0 )
Code: Select all
Function RibbonBarEvent( cEvent, aParams, pParams, aButtons )
MsgInfo(ValType(cEvent))
As suggested by you I tried CoInitialize() before calling IsActiveX( cProgId ) but still IsActivex() is always returning .F.
I tried a utility named RegDllView, to check whether the OCX is registered, and it shows that the OCX is regsitered in the system. I am using Windows XP SP3
I tested this in 2 other Win XP Pc's and 1 Windows 7 PC.
I even doubt the licence issue as said in this thread http://forums.fivetechsupport.com/viewt ... =3&t=13351
I am looking for a code to pass the licence key when the contols are used in Client PC (when we use the control on a PC where the CodeJock setup.exe is not installed). In the write up it is said that the valid license key should be used on Form Initialiase using the property GlobalSetting:Licence of the CodeJock Control, but the app is crashing before I can access the Property's of the Control at TActivex initialize itself
Thanks & REgards
Anser
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Codejock RibbonBar first tests
Anser,
Are you using 12.1.1 or 13.0.0 ?
Have you tried both ?
Are you using 12.1.1 or 13.0.0 ?
Have you tried both ?