My RibbonBar + ExplorerBar

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

Re: My RibbonBar + ExplorerBar

Post by Antonio Linares »

Fafi,

You may need to create the ImageList as an OleAuto object.

Look for the cProgId to create an ImageList using CreateObject( cProgId ).
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
carlos vargas
Posts: 1421
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: My RibbonBar + ExplorerBar

Post by carlos vargas »

the link in rapidshre is dead.
can you put the file in other file host. mediafire, filefront, etc.

please.

thank you.

salu2
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
User avatar
fafi
Posts: 169
Joined: Mon Feb 25, 2008 2:42 am

Re: My RibbonBar + ExplorerBar

Post by fafi »

carlos vargas wrote:the link in rapidshre is dead.
can you put the file in other file host. mediafire, filefront, etc.

please.

thank you.

salu2
Hi ! Carlos , I changed to mediafire :

http://forums.fivetechsupport.com/viewt ... =3&t=15244

Please vote me.. with your results

Regards
Fafi
User avatar
fafi
Posts: 169
Joined: Mon Feb 25, 2008 2:42 am

Re: My RibbonBar + ExplorerBar

Post by fafi »

Hi ! Freinds

I create OCX Button supports all Image Type :

Please vote, What is your errors..

Here is screen shoot :

Image

the source code FWH :

Code: Select all


/*
 My OCX create with VB
 by Fafi
 
*/

#define    Caption_Left_Top       1
#define    Caption_Left_Middle    2
#define    Caption_Left_Bottom    3
#define    Caption_Center_Top     4
#define    Caption_Center_Middle  5
#define    Caption_Center_Bottom  6
#define    Caption_Right_Top      7
#define    Caption_Right_Middle   8
#define    Caption_Right_Bottom   9

#define  Text_Caption_Normal    1
#define  Text_Caption_Embossed  2
#define  Text_Caption_Engraved  3
#define  Text_Caption_OutLine   4
#define  Text_Caption_Shadow    5


    

#include "FiveWin.ch"


static oGetEvent,cGetEvent,oWnd,oBrushSilver,oBrushBlack,oBrushBlue,oAct1,oAct2,oAct,oAct3,oAct4

function Main()  
   Local oDlg, oWnd, oAct := array(10)
   
   local aCaption := { ;
    "Media Center",;
    "Media Player",;
    "Office 2007 1",;
    "Office 2007 2",;
    "Vista 1",;
    "Vista 2",;
    "XP Blue",;
    "XP Olive Green",;
    "XP Silver";
   }
   
   if !file("FafiButtonx.StylerButton.ocx")
      MsgAlert("Can't find FafiButtonx.StylerButton.ocx")
      return nil
   else
      RegisterServer( "FafiButtonx.StylerButton.ocx" )
   endif   
   
   DEFINE ICON oIcon NAME "BASEPRO" 
   

   DEFINE WINDOW oWnd TITLE "FWH Support Fafi OCX" ICON oIcon
   
   
   DEFINE BRUSH oBrushSilver FILE "SILVER.BMP"

   
   DEFINE DIALOG oDlg FROM 0, 0 TO 400,400 PIXEL OF oWnd TRANSPARENT STYLE nOr( WS_VISIBLE, WS_CHILD )  BRUSH oBrushSilver
   
   nRow := 300
   nCol := 10
   oAct := TActiveX():New( oWnd, "FafiButtonx.StylerButton", nRow, nCol, 200, 200 )  
   oAct:bOnEvent := { | cEvent, aParams, pParams | ButtonEvent( cEvent, aParams, pParams ) }
   oAct:SetProp("Caption","Alpha")
   oAct:SetProp("ImageFile","trash.bmp")
   oAct:SetProp("ImageTopPosition",16)
   oFontButton := TOleAuto():New( ActXPdisp( oAct:hActiveX ) )
   oFontButton := oFontButton:Font()
   oFontButton:Size := 40
   oFontButton:Name := "Times New Roman"
   oAct:SetProp("CaptionAlignment",Caption_Center_Bottom)   
   
   nRow := 10
   nCol := 350
   for i := 1 to 9
   
                                      // nTop, nLeft. nWidth, nHeight
      oAct := TActiveX():New( oWnd, "FafiButtonx.StylerButton", nRow, nCol, 100, 35 )  
      oAct:bOnEvent := { | cEvent, aParams, pParams | ButtonEvent( cEvent, aParams, pParams ) }
      oAct:SetProp("Caption","Black Small")
      oAct:SetProp("Theme",5)
      oAct:SetProp("ForeColor",CLR_GREEN )
      oAct:SetProp("CaptionAlignment",Caption_Right_Middle)   
      oAct:SetProp("ImageFile","heart.ico")
      oAct:SetProp("ImageTopPosition",2 )
      oAct:SetProp("RoundedValue",10)
      nRow += 40
   next
   
   
   nRow := 10
   nCol := 10
   for i := 1 to 9
   
                                      // nTop, nLeft. nWidth, nHeight
      oAct := TActiveX():New( oWnd, "FafiButtonx.StylerButton", nRow, nCol, 120, 25 )  
      oAct:bOnEvent := { | cEvent, aParams, pParams | ButtonEvent( cEvent, aParams, pParams ) }
      oAct:SetProp("Caption",aCaption[i]+" Style")
      oAct:SetProp("Theme",i)
      
   
      nRow += 30
   
   next
   
   nRow := 10
   nCol := 150
                                      // nTop, nLeft. nWidth, nHeight
   oAct := TActiveX():New( oWnd, "FafiButtonx.StylerButton", nRow, nCol, 150, 50 )  
   oAct:bOnEvent := { | cEvent, aParams, pParams | ButtonEvent( cEvent, aParams, pParams ) }
   
   oAct:SetProp("Caption","Normal Button")
   oAct:SetProp("CaptionEffect",Text_Caption_Shadow)
   
   oFontButton := TOleAuto():New( ActXPdisp( oAct:hActiveX ) )
   oFontButton := oFontButton:Font()
   oFontButton:Size := 14
   oFontButton:Name := "Tahoma"
   
  
   
   nRow += 55
   nCol := 150
   
                                      // nTop, nLeft. nWidth, nHeight
   oAct := TActiveX():New( oWnd, "FafiButtonx.StylerButton", nRow, nCol, 150, 50 )  
   oAct:bOnEvent := { | cEvent, aParams, pParams | ButtonEvent( cEvent, aParams, pParams ) }
   oAct:SetProp("Caption","Round Button")
   
   oFontButton := TOleAuto():New( ActXPdisp( oAct:hActiveX ) )
   oFontButton := oFontButton:Font()
   oFontButton:Size := 14
   oFontButton:Name := "Tahoma"
   oAct:SetProp("RoundedValue",20)
   
   nRow += 55
   nCol := 150
   
                                      // nTop, nLeft. nWidth, nHeight
   oAct := TActiveX():New( oWnd, "FafiButtonx.StylerButton", nRow, nCol, 180, 60 )  
   oAct:bOnEvent := { | cEvent, aParams, pParams | ButtonEvent( cEvent, aParams, pParams ) }
   oAct:SetProp("Caption","Alpha Bitmap")
   oAct:SetProp("ImageFile","explorer1.bmp")
   oAct:SetProp("CaptionAlignment",Caption_Right_Middle)   
   oAct:SetProp("CaptionEffect",Text_Caption_OutLine)
   oAct:SetProp("ForeColor",nRGB(152,37,2) )
   oFontButton := TOleAuto():New( ActXPdisp( oAct:hActiveX ) )
   oFontButton := oFontButton:Font()
   oFontButton:Size := 14
   oFontButton:Name := "Tahoma"
   
   nRow += 65
   nCol := 150
   
                                      // nTop, nLeft. nWidth, nHeight
   oAct := TActiveX():New( oWnd, "FafiButtonx.StylerButton", nRow, nCol, 80, 100 )  
   oAct:bOnEvent := { | cEvent, aParams, pParams | ButtonEvent( cEvent, aParams, pParams ) }
   oAct:SetProp("Caption","PNG")
   oAct:SetProp("ImageFile","BinEmpty1.png")
   oAct:SetProp("CaptionAlignment",Caption_Right_Middle)   
   oAct:SetProp("CaptionEffect",Text_Caption_OutLine)
   oAct:SetProp("ForeColor",nRGB(152,37,2) )
   oAct:SetProp("ImageTopPosition",10 )
   oFontButton := TOleAuto():New( ActXPdisp( oAct:hActiveX ) )
   oFontButton := oFontButton:Font()
   oFontButton:Size := 14
   oFontButton:Name := "Tahoma"
   
   
   
   nCol := 250
   
                                      // nTop, nLeft. nWidth, nHeight
   oAct := TActiveX():New( oWnd, "FafiButtonx.StylerButton", nRow, nCol, 80, 100 )  
   oAct:bOnEvent := { | cEvent, aParams, pParams | ButtonEvent( cEvent, aParams, pParams ) }
   oAct:SetProp("Caption","ICON")
   oAct:SetProp("ImageFile","ActiveContentWizard.ico")
   oAct:SetProp("CaptionAlignment",Caption_Center_Bottom)   
   oAct:SetProp("CaptionEffect",Text_Caption_OutLine)
   oAct:SetProp("ForeColor",nRGB(152,37,2) )
   oAct:SetProp("ImageTopPosition",10 )
   oFontButton := TOleAuto():New( ActXPdisp( oAct:hActiveX ) )
   oFontButton := oFontButton:Font()
   oFontButton:Size := 14
   oFontButton:Name := "Tahoma"
   
   
   
   ACTIVATE DIALOG oDlg NOWAIT VALID oWnd:End()
   
   ACTIVATE WINDOW oWnd ON RESIZE ( oDlg:SetSize( oWnd:nWidth, oWnd:nHeight ) ) MAXIMIZED

Return Nil

static function ButtonEvent( cEvent, aParams, pParams )
   
   cEvent := upper(alltrim(cEvent))
   
   if left(cEvent,5) == "MOUSE" // don't use mouse event
   else   
      if cEvent == "CLICK"
         cGetEvent := aParams[1]
         MsgAlert(cGetEvent)
      endif   
   endif
   
return nil 

  
   

#pragma BEGINDUMP

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

typedef LONG ( * PDLLREGISTERSERVER ) ( void );

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

      FreeLibrary( hDll );
   }
   
   hb_retnl( lReturn );
}        

#pragma ENDDUMP

 
my OCX just for Demo only.. included main.exe created by xHB :
http://www.mediafire.com/?sharekey=4e91 ... f6e8ebb871

Thank's for report errors to me..

Regards
Fafi
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: My RibbonBar + ExplorerBar

Post by ukoenig »

Hello fafi,

At first, a very nice looking job.

I tested Your Exe-file with 3 Window-Versions.

With Windows VISTA there is the same problem like Your other OCX ( no display ).
A test with WINDOWS 2000 works this time ( with Your other OCX, there was a error )
A test with XP was ok as well.

Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: My RibbonBar + ExplorerBar

Post by Antonio Linares »

Fafi,

It looks very nice! :-)

Congratulations!
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
fafi
Posts: 169
Joined: Mon Feb 25, 2008 2:42 am

Re: My RibbonBar + ExplorerBar

Post by fafi »

Uwe,

Thank's for report
I think, I have to create my OCX with VB for Vista ?
What is VB for Vista ?


Antonio,
I want to make myRIbbonbar, MyExplorerbar and MyButton class with FWH
Can you guide me.. how to understand Class on FWH
How to start ?


Thank's for help
Regards
Fafi
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: My RibbonBar + ExplorerBar

Post by Antonio Linares »

Fafi,

> I want to make myRIbbonbar, MyExplorerbar and MyButton class with FWH

You have to create a new Class inherited from Class TActiveX:

Code: Select all

CLASS TMyRibbonBar FROM TActiveX

   CLASSDATA lRegistered AS LOGICAL

   METHOD New( oWnd, nTop, nLeft, nWidth, nHeight )

ENDCLASS

METHOD New( oWnd, nTop, nLeft, nWidth, nHeight ) CLASS TMyRibbonBar

   ::Super:New( oWnd, "FafiOCX.RibbonBar", nTop, nLeft, nWidth, nHeight )

return Self
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
fafi
Posts: 169
Joined: Mon Feb 25, 2008 2:42 am

Re: My RibbonBar + ExplorerBar

Post by fafi »

Antonio Linares wrote:Fafi,

> I want to make myRIbbonbar, MyExplorerbar and MyButton class with FWH

You have to create a new Class inherited from Class TActiveX:

Code: Select all

CLASS TMyRibbonBar FROM TActiveX

   CLASSDATA lRegistered AS LOGICAL

   METHOD New( oWnd, nTop, nLeft, nWidth, nHeight )

ENDCLASS

METHOD New( oWnd, nTop, nLeft, nWidth, nHeight ) CLASS TMyRibbonBar

   ::Super:New( oWnd, "FafiOCX.RibbonBar", nTop, nLeft, nWidth, nHeight )

return Self
 
No.. ! Antonio,
I want to translate my VB class to FWH class, as you created class object Bitmap,Say, BtnBMP etc.. on FWH,
as you Know, when I create Class on VB there are object :
1. UserControl
2. Label
3. Image.. etc

all object can put some function from Windows API, :

Code: Select all

''Windows API Functions
Private Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long
 
and more Window API..

Where are FWH Windapi Function ? and how to call all them...


Please help.. and give me sample
for example .. let's create how to draw rectangle on my Dialog/Window form, from oRectangle class

Code: Select all

#include "fivewin.ch"

function Main()

define dialog oDlg from 1,1 to 400,400 pixel

oRect := TRect():New(oDlg, 1,1,100,100 )

activate dialog oDlg

return nil


CLASS TRECT FROM TControl
   
   CLASSDATA lRegistered AS LOGICAL
      
   
   METHOD New(oWnd,nTop,nLeft,nBottom,nRight) CONSTRUCTOR

ENDCLASS


METHOD New(oWnd,nTop,nLeft,nBottom,nRight) CLASS TRECT
   
   local nStylePen := PS_SOLID 
   local nWidthPen := 2
   local nColorPen := CLR_RED
   
    ::oWnd    := oWnd
    ::nTop    := nTop
    ::nLeft   := nLeft
    ::nBottom := nBottom
    ::nRight  := nRight

   Rectangle( ::oWnd:hDC, ::nTop, ::nLeft, ::nBottom, ::nRight,CreatePen( nStylePen, nWidthPen, nColorPen ) )
   
return self
 
Please help me.. not work.. :(

Regards
Fafi
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: My RibbonBar + ExplorerBar

Post by StefanHaupt »

Uwe,
ukoenig wrote: With Windows VISTA there is the same problem like Your other OCX ( no display ).
A test with WINDOWS 2000 works this time ( with Your other OCX, there was a error )
A test with XP was ok as well.
with vista the function RegisterServer() fails, if you are not logged in as Adminsitrator. It does not work logged in as a normal user with administator rights. You may right click on the application and select "Run as Administrator".

The demo works fine here under vista.
kind regards
Stefan
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: My RibbonBar + ExplorerBar

Post by Antonio Linares »

Fafi,

Please review FWH\source\classes\TPanel.prg as it is a very simple class that can be used as a template for new classes :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
fafi
Posts: 169
Joined: Mon Feb 25, 2008 2:42 am

Re: My RibbonBar + ExplorerBar

Post by fafi »

Hi..! Antonio,

It's work :

Code: Select all

#include "fivewin.ch"

#include "Constant.ch"

#define LTGRAY_BRUSH       1
#define TRANSPARENT        1

#define SS_CENTER          1
#define SS_RIGHT           2
#define SS_GRAYRECT        5 // BOXRECT

#define DLGC_BUTTON     8192   // 0x2000

#define COLOR_WINDOW       5
#define COLOR_WINDOWTEXT   8
#define COLOR_BTNFACE     15

#define WM_NCHITTEST     132  // 0x84


function Main()

define dialog oDlg from 1,1 to 400,400 pixel

oRect := TRect():New(oDlg,2,2,100,100 )

@30,10 SAY "Press down on My Rectangle" size 100,12 of oDlg pixel

activate dialog oDlg

return nil


CLASS TRect FROM TControl
   
   CLASSDATA lRegistered AS LOGICAL
      
   DATA   lProcessing AS LOGICAL INIT .f.      
      
   METHOD New(oWnd,nTop,nLeft,nBottom,nRight,cMsg,lAdjust,lUpdate,cLayout,bAction,nWidth,nHeight,lBorder) CONSTRUCTOR

   METHOD LButtonDown( nRow, nCol ) 
      
   METHOD LButtonUp( nRow, nCol )
      
   METHOD MouseMove( nRow, nCol, nKeyFlags )      
      

ENDCLASS


METHOD New(oWnd,nTop,nLeft,nWidth,nHeight,cMsg) CLASS TRECT
   
   DEFAULT cMsg := " ", nWidth := 20, nHeight := 20, oWnd := GetWndDefault()
   
   * Default class from Tcontrol
   ::nStyle    = nOR( WS_CHILD, WS_VISIBLE )
   ::nId       = ::GetNewId()
   ::oWnd      = oWnd
   ::cMsg      = cMsg
   ::nTop      = nTop
   ::nLeft     = nLeft
   ::nBottom   = nTop + nHeight - 1
   ::nRight    = nLeft + nWidth - 1
   
   ::Register( nOR( CS_VREDRAW, CS_HREDRAW ) )

   if ! Empty( oWnd:hWnd )
      ::Create( "STATIC" )
      ::SetColor( ::nClrText, ::nClrPane )
      oWnd:AddControl( Self )
   else
      oWnd:DefControl( Self )
   endif

   
return self

METHOD LButtonDown( nRow, nCol ) CLASS TRect
   MsgAlert("Press Down")
return 0

METHOD LButtonUp( nRow, nCol )  CLASS TRect
   MsgAlert("Up")
return 0

METHOD MouseMove( nRow, nCol, nKeyFlags ) CLASS TRect
return 0   

 
Hi.. Stefan,
I glad to know your report, Thank's

Antonio,
I'm creating my Class for FWH :D
Thank's for help

Regards
Fafi
Post Reply