Hi Antonio,
I post my last paste picture below source code.
Thanks post my code.
Regards,
Richard
Richard
Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 32bit
MySQL v8.0
Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 64bit
Hi Antonio,
I post my last paste picture below source code.
Thanks post my code.
Regards,
Richard
Richard,
Ok, thanks ![]()
#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
#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#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#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
if ! IsActiveX( "Codejock.CommandBars.v13.0.0.ocx" )
MsgStop( "ActiveX missing" )
return nil
endifI think that first you have to register the ActiveX as an administrator. But not 100% sure about it.
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#pragma BEGINDUMP
#include <hbapi.h>
unsigned long CoInitialize( void * );
HB_FUNC( COINITIALIZE )
{
hb_retnl( CoInitialize( NULL ) );
}
#pragma ENDDUMPfunction RibbonBarEvent( cEvent, aParams, pParams, aButtons, oWnd )
IF Valtype( cEvent ) == "N"
DO CASE
CASE cEvent == 1
cEvent := "Execute"
OTHERWISE
cEvent := ""
ENDCASE
ENDIFFafi,
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!
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:
oAct := TActiveX():New( oWnd, "Codejock.CommandBarsFrame.12.1.1", 0, 0, 0, 0 )Function RibbonBarEvent( cEvent, aParams, pParams, aButtons )
MsgInfo(ValType(cEvent))Anser,
Are you using 12.1.1 or 13.0.0 ?
Have you tried both ?