FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Codejock RibbonBar first tests
Posts: 866
Joined: Tue Oct 16, 2007 08:57 AM

Re: Codejock RibbonBar first tests

Posted: Wed Apr 01, 2009 06:39 AM
Add StatusBar



Code (fw): Select all Collapse
#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
Best Regards,



Richard



Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 32bit

MySQL v8.0

Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 64bit
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM

Re: Codejock RibbonBar first tests

Posted: Wed Apr 01, 2009 07:12 AM

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

Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM

Re: Codejock RibbonBar first tests

Posted: Wed Apr 01, 2009 07:33 AM

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

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: Codejock RibbonBar first tests

Posted: Wed Apr 01, 2009 08:34 AM

Daniel,

Simply brilliant! :-)

many thanks!

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: Codejock RibbonBar first tests

Posted: Wed Apr 01, 2009 08:35 AM

Richard,

Thanks for joining us :-)

Your help is very welcome!

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: Codejock RibbonBar first tests

Posted: Wed Apr 01, 2009 08:36 AM

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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: Codejock RibbonBar first tests

Posted: Wed Apr 01, 2009 08:36 AM

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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: Codejock RibbonBar first tests

Posted: Wed Apr 01, 2009 08:43 AM
Otto,

This is the function. We have not tested it yet with this OCX:
Code (fw): Select all Collapse
#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
Posts: 392
Joined: Tue Mar 10, 2009 11:54 AM

Re: Codejock RibbonBar first tests

Posted: Wed Apr 01, 2009 08:54 AM
Hi all,
on my machine <cEvent> is numerical, so I have to add the the following code to RibbonBarEvent():

Code (fw): Select all Collapse
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 :-)
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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: Codejock RibbonBar first tests

Posted: Wed Apr 01, 2009 09:00 AM

Frank,

Thanks for the feedback :-)

What Windows version are you using ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 392
Joined: Tue Mar 10, 2009 11:54 AM

Re: Codejock RibbonBar first tests

Posted: Wed Apr 01, 2009 09:22 AM

Antonio,
vista64 SP1, but found the same behavior with XP32 SP3 under VMware.

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
Posts: 866
Joined: Tue Oct 16, 2007 08:57 AM

Re: Codejock RibbonBar first tests

Posted: Wed Apr 01, 2009 10:24 AM
Add ToolTipContext



Code (fw): Select all Collapse
#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
Best Regards,



Richard



Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 32bit

MySQL v8.0

Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 64bit
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: Codejock RibbonBar first tests

Posted: Wed Apr 01, 2009 11:31 AM
Richard,

Many thanks for your help! :-)

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 603
Joined: Sun May 04, 2008 08:44 PM

Re: Codejock RibbonBar first tests

Posted: Wed Apr 01, 2009 11:44 AM

oRb:AddSystemButton()

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: Codejock RibbonBar first tests

Posted: Wed Apr 01, 2009 11:52 AM

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