Codejock RibbonBar first tests
- richard-service
- Posts: 806
- 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
Best Regards,
Richard
Harbour 3.2.0dev (r2402101027) => Borland C++ v7.7 32bit
MySQL v8.0 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
Richard
Harbour 3.2.0dev (r2402101027) => Borland C++ v7.7 32bit
MySQL v8.0 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
- Antonio Linares
- Site Admin
- Posts: 42418
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 14 times
- Been thanked: 48 times
- Contact:
- Antonio Linares
- Site Admin
- Posts: 42418
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 14 times
- Been thanked: 48 times
- 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 | Expand
#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: 42418
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 14 times
- Been thanked: 48 times
- Contact:
Re: Codejock RibbonBar first tests
Visual RibbonBar: Dynamically adding tabs and groups
RibbonBar.prg
RibbonBar.prg
Code: Select all | Expand
#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: 42418
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 14 times
- Been thanked: 48 times
- Contact:
Re: Codejock RibbonBar first tests
Visual RibbonBar: enhanced version
RibbonBar.prg
RibbonBar.prg
Code: Select all | Expand
#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: 42418
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 14 times
- Been thanked: 48 times
- Contact:
Re: Codejock RibbonBar first tests
Visual RibbonBar: adding controls (buttons), developed together with Daniel
RibonBar.prg
RibonBar.prg
Code: Select all | Expand
#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
Re: Codejock RibbonBar first tests
Hi ,
Anybody here tried to run the generated Sample Exe on a PC other than the Development PC (ie On a PC where the CodeJock Setup is not installed).
For me it is giving the following error.
Regards
Anser
Anybody here tried to run the generated Sample Exe on a PC other than the Development PC (ie On a PC where the CodeJock Setup is not installed).
For me it is giving the following error.
Regards
Anser
- Antonio Linares
- Site Admin
- Posts: 42418
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 14 times
- Been thanked: 48 times
- 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 | Expand
if ! IsActiveX( "Codejock.CommandBars.v13.0.0.ocx" )
MsgStop( "ActiveX missing" )
return nil
endif
Re: Codejock RibbonBar first tests
Dear Mr.Antonio,
I am testing the problem in Win XP as Administrator.
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 think that first you have to register the ActiveX as an administrator. But not 100% sure about it.
I am testing the problem in Win XP as Administrator.
Another Problem which I have seen is that IsActivex() is always returning .F.
Code: Select all | Expand
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: 42418
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 14 times
- Been thanked: 48 times
- 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 | Expand
#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 | Expand
function RibbonBarEvent( cEvent, aParams, pParams, aButtons, oWnd )
IF Valtype( cEvent ) == "N"
DO CASE
CASE cEvent == 1
cEvent := "Execute"
OTHERWISE
cEvent := ""
ENDCASE
ENDIF
HTH
Windows 11 Pro 22H2 22621.1848
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
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!
Windows 11 Pro 22H2 22621.1848
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
- Antonio Linares
- Site Admin
- Posts: 42418
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 14 times
- Been thanked: 48 times
- 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:
viewtopic.php?p=78087#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:
viewtopic.php?p=78087#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 viewtopic.php?f=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 | Expand
oAct := TActiveX():New( oWnd, "Codejock.CommandBarsFrame.12.1.1", 0, 0, 0, 0 )
I tried to check the ValType of cEvent, but the application crashes before reaching that point
Code: Select all | Expand
Function RibbonBarEvent( cEvent, aParams, pParams, aButtons )
MsgInfo(ValType(cEvent))
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 viewtopic.php?f=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: 42418
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 14 times
- Been thanked: 48 times
- Contact: