Codejock RibbonBar first tests

User avatar
richard-service
Posts: 583
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan
Contact:

Re: Codejock RibbonBar first tests

Post by richard-service »

Add StatusBar

Image

Code: Select all

#include "FiveWin.ch"

#define xtpControlError              0
#define xtpControlButton             1
#define xtpControlPopup              2
#define xtpControlButtonPopup        3
#define xtpControlSplitButtonPopup   4
#define xtpControlComboBox           5
#define xtpControlEdit               6
#define xtpControlCustom             7
#define xtpControlLabel              8
#define xtpControlCheckBox           9
#define xtpControlGallery           10
#define xtpControlRadioButton       11

#define xtpImageNormal               0
#define xtpImageDisabled             1
#define xtpImageHot                  2
#define xtpImageChecked              3
#define xtpImagePressed              4

function Main()  

   local oWnd, oAct, oRb, oTabFiles, oTabEdit, oTabBuild, oIcons
   local oGroup1, oGroup2, oButton1, oButton2, aButtons := {}
   local oButton3, oButton4, oBmp1, oBmp2, oBmp3
   
   local oStatusBar

   DEFINE WINDOW oWnd

   
  obmp1 := TBitmap():Define( , "..\bitmaps\16x16\new2.bmp", oWnd )
  obmp2 := TBitmap():Define( , "..\bitmaps\16x16\open2.bmp", oWnd ) 
  obmp3 := TBitmap():Define( , "..\bitmaps\alphabmp\explorer.bmp", oWnd ) 


   @ 0, 0 ACTIVEX oAct PROGID "Codejock.CommandBarsFrame.12.1.1" OF oWnd


   oAct:bOnEvent = { | cEvent, aParams, pParams | RibbonBarEvent( cEvent, aParams, pParams, aButtons ) }

   oAct:Do( "AttachToWindow", oWnd:hWnd )
   
   oAct:Do( "EnableOffice2007Frame", .T. )
   oAct:Do( "VisualTheme", .T. ) 
   
             
   // StatusBar-Richard
   oStatusBar := TOleAuto():New( ActXPdisp( oAct:hActiveX ) )
   oStatusBar:StatusBar:Visible = .T.

   oStatusBar:StatusBar:AddPane( 0 )
   oStatusBar:StatusBar:AddPane( 59137 )
   oStatusBar:StatusBar:AddPane( 59138 )
   oStatusBar:StatusBar:AddPane( 59139 )   
   oStatusBar:StatusBar:IdleText = "FWH support Codejock RibbonBar"      
    
   
   oIcons := oAct:Do( "icons" )
   
   oIcons:AddBitmap( oBmp1:hBitmap,1,xtpImageNormal,.f. ) 
   oIcons:AddBitmap( oBmp2:hBitmap,2,xtpImageNormal,.f. ) 
   oIcons:AddBitmap( oBmp3:hBitmap,3,xtpImageNormal,.t. ) // 4th param, Bool to Alpha Channel Support
   oIcons:LoadBitmap( "..\bitmaps\32x32\edit.bmp",4, xtpImageNormal) 
 
   oAct:Hide()

   oRb = oAct:Do( "AddRibbonBar", "fwh" )

   oTabFiles = oRb:InsertTab( 0, "&Files" )  
   oTabEdit  = oRb:InsertTab( 1, "&Edit" )  
   oTabBuild = oRb:InsertTab( 2, "&Build" )  
   
   oGroup1 = oTabFiles:Groups:AddGroup( "Test 1", 0 )
   oGroup1:ShowOptionButton = .T.
   
   oGroup2 = oTabFiles:Groups:AddGroup( "Test 2", 1 )  

   oButton1 = oGroup1:Add( xtpControlButton, 2, "First" )
   oButton2 = oGroup1:Add( xtpControlButton, 1, "Second" )
   
   oButton3 = oGroup2:Add( xtpControlButton, 4, NIL ) 
   oButton4 = oGroup2:Add( xtpControlButton, 3, NIL )
   oButton4:SetIconSize( 64,64 )
   oButton4:Width = 70
   oButton4:Height = 70
      
   
   AAdd( aButtons, oButton1 )
   AAdd( aButtons, oButton2 )

   oButton1:Caption = "FiveWin power!"
   oButton1:TooltipText = "Ribbonbar for FWH"
   
   ACTIVATE WINDOW oWnd
     
return nil

function RibbonBarEvent( cEvent, aParams, pParams, aButtons )

   do case
      case cEvent == "Execute" .and. Len( aButtons ) > 0
           do case
              case aButtons[ 1 ]:hObj == aParams[ 1 ]
                   MsgInfo( "Button 1" )
                   
              case aButtons[ 2 ]:hObj == aParams[ 1 ]
                   MsgInfo( "Button 2" )
           endcase        
   endcase        
   
return nil
 
 

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
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Codejock RibbonBar first tests

Post by anserkk »

Hi all,

Do we need this Activex to be registered on all client PC's to get this Ribbon control working in our application?
If so is there any way by which we can avoid it, so that this control is included in the .Exe itself.

Can we use the Impdef and create this as a lib and then linked to our exe so that there is no external dependencies

May be I am asking a very stupid question :)

Regards

Anser
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Re: Codejock RibbonBar first tests

Post by Otto »

Hello Antonio,

I downloaded the demo from CodeJock changed your code samples to Version: 13.0.0 which is now in the download.
All worked at the first try. Thank you very much.
Do you know what we have to supply to the clients to get a FWH program running which the CodeJock components inside.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org

********************************************************************
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Codejock RibbonBar first tests

Post by Antonio Linares »

Daniel,

Simply brilliant! :-)

many thanks!
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Codejock RibbonBar first tests

Post by Antonio Linares »

Richard,

Thanks for joining us :-)

Your help is very welcome!
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Codejock RibbonBar first tests

Post by Antonio Linares »

Anser,

We don't know yet if codejock provides a LIB instead of an OCX.

We may need to ask CodeJock :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Codejock RibbonBar first tests

Post by Antonio Linares »

Otto,

Could you please provide the CodeJock download url where to get the demo version ? Thanks :-)

Afaik, you just need to supply the OCX and register it from your application. We recently published a RegisterDll() here in the forums that may be ok.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Codejock RibbonBar first tests

Post by Antonio Linares »

Otto,

This is the function. We have not tested it yet with this OCX:

Code: Select all

#pragma BEGINDUMP

#include <hbapi.h>
#include <windows.h>

typedef LONG ( * PDLLREGISTERSERVER ) ( void ); 

HB_FUNC( REGISTERDLL )
{
   HMODULE hDll = LoadLibrary( hb_parc( 1 ) );
   LONG lReturn = 0;
   
   if( hDll )
   {
      FARPROC pRegisterServer = GetProcAddress( hDll, "DllRegisterServer" );
      
      if( pRegisterServer )
         lReturn = ( ( PDLLREGISTERSERVER ) pRegisterServer )();
   }
   
   hb_retnl( lReturn );
}         

#pragma ENDDUMP
 
For example: MsgInfo( RegisterDll( "Codejock.CommandBars.v12.1.1.ocx" ) )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
frose
Posts: 327
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Gütersloh
Contact:

Re: Codejock RibbonBar first tests

Post by frose »

Hi all,
on my machine <cEvent> is numerical, so I have to add the the following code to RibbonBarEvent():

Code: Select all

IF Valtype( cEvent ) == "N"
      DO CASE
         CASE cEvent == 1 .AND. Len( aButtons ) > 0
            //
            // EventExecute - Occurs when a command bar control is clicked.
            //
              DO CASE
                 CASE aButtons[ 1 ]:hObj == aParams[ 1 ]
                      MsgInfo( "Button 1" )
                 CASE aButtons[ 2 ]:hObj == aParams[ 1 ]
                      MsgInfo( "Button 2" )
              ENDCASE
      ENDCASE
ELSEIF Valtype( cEvent ) == "C"
   ...
 
and it works, but don't ask me why :?
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Codejock RibbonBar first tests

Post by Antonio Linares »

Frank,

Thanks for the feedback :-)

What Windows version are you using ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
frose
Posts: 327
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Gütersloh
Contact:

Re: Codejock RibbonBar first tests

Post by frose »

Antonio,
vista64 SP1, but found the same behavior with XP32 SP3 under VMware.
User avatar
richard-service
Posts: 583
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan
Contact:

Re: Codejock RibbonBar first tests

Post by richard-service »

Add ToolTipContext

Image

Code: Select all

#include "FiveWin.ch"

#define xtpControlError              0
#define xtpControlButton             1
#define xtpControlPopup              2
#define xtpControlButtonPopup        3
#define xtpControlSplitButtonPopup   4
#define xtpControlComboBox           5
#define xtpControlEdit               6
#define xtpControlCustom             7
#define xtpControlLabel              8
#define xtpControlCheckBox           9
#define xtpControlGallery           10
#define xtpControlRadioButton       11

#define xtpImageNormal               0
#define xtpImageDisabled             1
#define xtpImageHot                  2
#define xtpImageChecked              3
#define xtpImagePressed              4

function Main()  

   local oWnd, oAct, oRb, oTabFiles, oTabEdit, oTabBuild, oIcons
   local oGroup1, oGroup2, oButton1, oButton2, aButtons := {}
   local oButton3, oButton4, oBmp1, oBmp2, oBmp3
   
   local oStatusBar, oToolTipContext

   DEFINE WINDOW oWnd

   
  obmp1 := TBitmap():Define( , "..\bitmaps\16x16\new2.bmp", oWnd )
  obmp2 := TBitmap():Define( , "..\bitmaps\16x16\open2.bmp", oWnd ) 
  obmp3 := TBitmap():Define( , "..\bitmaps\alphabmp\explorer.bmp", oWnd ) 


   oAct := TActiveX():New( oWnd, "Codejock.CommandBarsFrame.12.1.1", 0, 0, 0, 0 )  
   
   //@ 0, 0 ACTIVEX oAct PROGID "Codejock.CommandBarsFrame.12.1.1" OF oWnd


   oAct:bOnEvent = { | cEvent, aParams, pParams | RibbonBarEvent( cEvent, aParams, pParams, aButtons ) }

   oAct:Do( "AttachToWindow", oWnd:hWnd )
   
   oAct:Do( "EnableOffice2007Frame", .T. )
   oAct:Do( "VisualTheme", .T. ) 
           
   // ToolTipContext - Richard          
   oToolTipContext := TOleAuto():New( ActXPdisp( oAct:hActiveX ) )
   oToolTipContext := oToolTipContext:ToolTipContext()
   oToolTipContext:Style = 5  && xtpToolTipOffice2007
   oToolTipContext:ShowTitleAndDescription( .T., 0 )
   oToolTipContext:ShowImage( .T., 10000 )
   oToolTipContext:SetMargin( 2, 2, 2, 2 )
   oToolTipContext:MaxTipWidth = 180
   
   // StatusBar-Richard
   oStatusBar := TOleAuto():New( ActXPdisp( oAct:hActiveX ) )
   oStatusBar:StatusBar:Visible = .T.

   oStatusBar:StatusBar:AddPane( 0 )
   oStatusBar:StatusBar:AddPane( 59137 )
   oStatusBar:StatusBar:AddPane( 59138 )
   oStatusBar:StatusBar:AddPane( 59139 )   
   oStatusBar:StatusBar:IdleText = "FWH support Codejock RibbonBar"      
    
   
   oIcons := oAct:Do( "icons" )
   
   oIcons:AddBitmap( oBmp1:hBitmap,1,xtpImageNormal,.f. ) 
   oIcons:AddBitmap( oBmp2:hBitmap,2,xtpImageNormal,.f. ) 
   oIcons:AddBitmap( oBmp3:hBitmap,3,xtpImageNormal,.t. ) // 4th param, Bool to Alpha Channel Support
   oIcons:LoadBitmap( "..\bitmaps\32x32\edit.bmp",4, xtpImageNormal) 
 
   //oAct:Hide()

   oRb = oAct:Do( "AddRibbonBar", "fwh" )

   oTabFiles = oRb:InsertTab( 0, "&Files" )  
   oTabEdit  = oRb:InsertTab( 1, "&Edit" )  
   oTabBuild = oRb:InsertTab( 2, "&Build" )  
   
   oGroup1 = oTabFiles:Groups:AddGroup( "Test 1", 0 )
   oGroup1:ShowOptionButton = .T.
   
   oGroup2 = oTabFiles:Groups:AddGroup( "Test 2", 1 )  

   oButton1 = oGroup1:Add( xtpControlButton, 2, "First" )
   oButton2 = oGroup1:Add( xtpControlButton, 1, "Second" )
   
   oButton3 = oGroup2:Add( xtpControlButton, 4, NIL ) 
   oButton4 = oGroup2:Add( xtpControlButton, 3, NIL )
   oButton4:SetIconSize( 64,64 )
   oButton4:Width = 70
   oButton4:Height = 70
    
   
   
   AAdd( aButtons, oButton1 )
   AAdd( aButtons, oButton2 )

   oButton1:Caption = "FiveWin power!"
   oButton1:TooltipText = "Ribbonbar for FWH"
   
    
   
   ACTIVATE WINDOW oWnd
     
return nil

function RibbonBarEvent( cEvent, aParams, pParams, aButtons )

   do case
      case cEvent == "Execute" .and. Len( aButtons ) > 0
           do case
              case aButtons[ 1 ]:hObj == aParams[ 1 ]
                   MsgInfo( "Button 1" )
                   
              case aButtons[ 2 ]:hObj == aParams[ 1 ]
                   MsgInfo( "Button 2" )
           endcase        
   endcase        
   
return nil

 
 
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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Codejock RibbonBar first tests

Post by Antonio Linares »

Richard,

Many thanks for your help! :-)

Do you know how to add little bitmaps at the top of the control ? Thanks

Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
lailton.webmaster
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Codejock RibbonBar first tests

Post by lailton.webmaster »

oRb:AddSystemButton()
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Codejock RibbonBar first tests

Post by Antonio Linares »

Lailton,

> oRb:AddSystemButton()

Many thanks for your help. You are a great CodeJock master and surely you can help many of us here.

What parameters should we provide to oRb:AddSystemButton() ?
Could you modify the test.prg that we are developing together ?

Thanks again,
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply