Page 2 of 8

Re: Codejock RibbonBar first tests

PostPosted: Wed Apr 01, 2009 6:39 am
by richard-service
Add StatusBar

Image

Code: Select all  Expand view

#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

Re: Codejock RibbonBar first tests

PostPosted: Wed Apr 01, 2009 7:12 am
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

Re: Codejock RibbonBar first tests

PostPosted: Wed Apr 01, 2009 7:33 am
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

Re: Codejock RibbonBar first tests

PostPosted: Wed Apr 01, 2009 8:34 am
by Antonio Linares
Daniel,

Simply brilliant! :-)

many thanks!

Re: Codejock RibbonBar first tests

PostPosted: Wed Apr 01, 2009 8:35 am
by Antonio Linares
Richard,

Thanks for joining us :-)

Your help is very welcome!

Re: Codejock RibbonBar first tests

PostPosted: Wed Apr 01, 2009 8:36 am
by Antonio Linares
Anser,

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

We may need to ask CodeJock :-)

Re: Codejock RibbonBar first tests

PostPosted: Wed Apr 01, 2009 8:36 am
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.

Re: Codejock RibbonBar first tests

PostPosted: Wed Apr 01, 2009 8:43 am
by Antonio Linares
Otto,

This is the function. We have not tested it yet with this OCX:
Code: Select all  Expand view

#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" ) )

Re: Codejock RibbonBar first tests

PostPosted: Wed Apr 01, 2009 8:54 am
by frose
Hi all,
on my machine <cEvent> is numerical, so I have to add the the following code to RibbonBarEvent():

Code: Select all  Expand view
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 :?

Re: Codejock RibbonBar first tests

PostPosted: Wed Apr 01, 2009 9:00 am
by Antonio Linares
Frank,

Thanks for the feedback :-)

What Windows version are you using ?

Re: Codejock RibbonBar first tests

PostPosted: Wed Apr 01, 2009 9:22 am
by frose
Antonio,
vista64 SP1, but found the same behavior with XP32 SP3 under VMware.

Re: Codejock RibbonBar first tests

PostPosted: Wed Apr 01, 2009 10:24 am
by richard-service
Add ToolTipContext

Image

Code: Select all  Expand view

#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

Re: Codejock RibbonBar first tests

PostPosted: Wed Apr 01, 2009 11:31 am
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

Re: Codejock RibbonBar first tests

PostPosted: Wed Apr 01, 2009 11:44 am
by lailton.webmaster
oRb:AddSystemButton()

Re: Codejock RibbonBar first tests

PostPosted: Wed Apr 01, 2009 11:52 am
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,