FWH own Class RibbonBar example: Moving between Tab's

FWH own Class RibbonBar example: Moving between Tab's

Postby Cgallegoa » Sat Sep 12, 2009 6:50 pm

Hello,

An example use of FWH-908 own Class RibbonBar: Now with xBrowse and moving between Tab´s.

Your imagination is the limit :)

Image

Image

Code:
Code: Select all  Expand view
#include "fivewin.ch"
#include "ribbon.ch"
#include "xBrowse.ch"

REQUEST DBFCDX

STATIC oWnd
STATIC oDlgRB[5]
STATIC oRBar
STATIC nOptTab01, nOptTab02, nOptTab03


function main()

   local oMenu, oMenuWnd, oBrush1
   local oGr, oGr1, oGr2, oGr3, oGr4
   local oBtn,   oBtn1,  oBtn2,  oBtn3,  oBtn4, oBtn5
   local oBtn6,  oBtn7,  oBtn8,  oBtn9,  oBtn10
   local oBtn11, oBtn12, oBtn13, oBtn14, oBtn15
   local oBtn16, oBtn17, oBtn18, oBtn19, oBtn20
   LOCAL oSay1, oBmp, oFont1
   LOCAL oCursor

   SET DATE ITALIAN
   SET CENTURY ON
   XBrNumFormat( 'E', .t. )
   SetBalloon( .t. )

   menu oMenu 2007
   endmenu

   DEFINE FONT oFont1 NAME "Arial" SIZE 0,-30 // BOLD
   DEFINE CURSOR oCursor HAND
   DEFINE BRUSH oBrush1 COLOR nRGB(210,210,255) // ,nRGB(255,255,255)
   DEFINE WINDOW oWnd TITLE "RibbonBar Test " + FWVERSION from 1,1 to 600,600 pixel MDI MENU oMenu brush oBrush1

   DEFINE RIBBONBAR oRBar WINDOW oWnd PROMPT "Tab 01", "Tab 02", "Tab 03";
         HEIGHT 120 TOPMARGIN 25

   ADD GROUP oGr  RIBBON oRBar TO OPTION 1 PROMPT "Clipboard" width 130 BITMAP "c:\fwh-908\bitmap\fivetech.BMP"

     @ 02, 05 ADD BUTTON oBtn1 GROUP oGr BITMAP "C:\FWH-908\bitmaps\cut16.BMP" ;
       SIZE 75, 20 PROMPT "Dialog 01"  MOSTLEFT round ;
       action ( Dialog01() )

     @ 24, 05 ADD BUTTON oBtn2 GROUP oGr BITMAP "C:\FWH-908\bitmaps\copy16.BMP" ;
       SIZE 75, 20 PROMPT "Dialog 02"  MOSTLEFT round ;
       action( Dialog02() )

     @ 46, 05 ADD BUTTON oBtn3 GROUP oGr BITMAP "C:\FWH-908\bitmaps\paste16.BMP" ;
       SIZE 75, 20 PROMPT "Dialog 03"  MOSTLEFT round ;
       action( Dialog03() )

   ADD GROUP oGr1 RIBBON oRBar TO OPTION 1 PROMPT "Font" WIDTH 205

     @ 10, 05 ADD BUTTON oBtn4 GROUP oGr1 BITMAP "C:\FWH-908\bitmaps\bold16.bmp" GROUPBUTTON FIRST SIZE 25, 20 ROUND ;
     ACTION( oBtn4:lSelected := !oBtn4:lSelected )

     @ 10, 30 ADD BUTTON oBtn5 GROUP oGr1 BITMAP "C:\FWH-908\bitmaps\italic16.bmp" GROUPBUTTON SIZE 25, 20 ROUND ;
        ACTION( oBtn5:lSelected := !oBtn5:lSelected )

     @ 10, 55 ADD BUTTON oBtn6 GROUP oGr1 BITMAP "C:\FWH-908\bitmaps\underline16.bmp" GROUPBUTTON SIZE 35, 20 ROUND Popup

     @ 10, 90 ADD BUTTON oBtn7 GROUP oGr1 BITMAP "C:\FWH-908\bitmaps\strikethru16.bmp" GROUPBUTTON SIZE 25, 20 ROUND;
        ACTION( oBtn7:lSelected := !oBtn7:lSelected )

     @ 10, 115 ADD BUTTON oBtn8 GROUP oGr1 BITMAP "C:\FWH-908\bitmaps\subindex16.bmp" GROUPBUTTON SIZE 25, 20 ROUND;
        ACTION( oBtn8:lSelected := !oBtn8:lSelected, oBtn9:lSelected := .f., oBtn9:Refresh() )

     @ 10, 140 ADD BUTTON oBtn9 GROUP oGr1 BITMAP "C:\FWH-908\bitmaps\superindex16.bmp" GROUPBUTTON SIZE 25, 20 ROUND ;
        ACTION( oBtn9:lSelected := !oBtn9:lSelected, oBtn8:lSelected := .f., oBtn8:Refresh() )

     @ 10, 165 ADD BUTTON oBtn10 GROUP oGr1 BITMAP "C:\FWH-908\bitmaps\casing16.bmp" GROUPBUTTON END SIZE 35, 20 ROUND POPUP

     @ 40, 05 ADD BUTTON oBtn11 GROUP oGr1 BITMAP "C:\FWH-908\bitmaps\hilight16.bmp" GROUPBUTTON FIRST SIZE 35, 20 ROUND POPUP

     @ 40, 40 ADD BUTTON oBtn12 GROUP oGr1 BITMAP "C:\FWH-908\bitmaps\fontcolor16.bmp" GROUPBUTTON END SIZE 35, 20 ROUND POPUP

     @ 40, 100 ADD BUTTON oBtn13 GROUP oGr1 BITMAP "C:\FWH-908\bitmaps\fontsizeincrease16.bmp" GROUPBUTTON FIRST SIZE 25, 20 ROUND

     @ 40, 125 ADD BUTTON oBtn15 GROUP oGr1 BITMAP "C:\FWH-908\bitmaps\fontsizedecrease16.bmp" GROUPBUTTON END SIZE 25, 20 ROUND

     @ 40, 175 ADD BUTTON oBtn16 GROUP oGr1 BITMAP "C:\FWH-908\bitmaps\style16.bmp" SIZE 25, 20 ROUND BORDER


   ADD GROUP oGr2 RIBBON oRBar TO OPTION 1 PROMPT "Exit" width 70 // BITMAP "c:\fwh-908\bitmap\fivetech.bmp"

     @ 15, 20 ADD BUTTON oBtn17 GROUP oGr2 BITMAP "C:\FWH-908\bitmaps\32x32\quit.BMP" ;
           SIZE 34,52 PROMPT "Exit" action( oWnd:End())

   ADD GROUP oGr3 RIBBON oRBar TO OPTION 2 PROMPT "Font" WIDTH 145

     @ 02, 05 ADD BUTTON oBtn18 GROUP oGr3 BITMAP "C:\FWH-908\bitmaps\AlphaBmp\AddUser.bmp" ;
       SIZE 125, 70 PROMPT "Dialog 01"  MOSTLEFT round ;
       action ( Dialog04() )

   ADD GROUP oGr4 RIBBON oRBar TO OPTION 2 PROMPT "Exit" width 70 // BITMAP "c:\fwh-908\bitmap\fivetech.bmp"

     @ 15, 20 ADD BUTTON oBtn19 GROUP oGr4 BITMAP "C:\FWH-908\bitmaps\32x32\quit.BMP" ;
           SIZE 34,52 PROMPT "Exit" action( oWnd:End())

   nOptTab01 := 1
   nOptTab02 := 4
   nOptTab03 := 5

   oRBar:aDialogs[1]:bGotFocus := {||bFunct:=&("{||Dialog"+StrZero(nOptTab01,2)+"()}"),Eval(bFunct)}
   oRBar:aDialogs[2]:bGotFocus := {||bFunct:=&("{||Dialog"+StrZero(nOptTab02,2)+"()}"),Eval(bFunct)}
   oRBar:aDialogs[3]:bGotFocus := {||bFunct:=&("{||Dialog"+StrZero(nOptTab03,2)+"()}"),Eval(bFunct)}

   SET MESSAGE OF oWnd TO "Testing FWH own Class RibbonBar" ;
      CENTERED CLOCK KEYBOARD 2007

   WndCenter(oWnd:hWnd)

   ACTIVATE WINDOW oWnd ON INIT (Dialog01()) // MAXIMIZED

   oRBar:End()
   dbCloseAll()
return nil





Procedure Dialog01()
   LOCAL aCoords:=GetCoors(oWnd:oWndClient), oBrush, oGet, cTxtGet:="Get in Dialog 01"
   LOCAL oFont1, oBmpAlpha1, oBmpAlpha2, oBrw, cAlias, aGrad
   LOCAL lEscapa:=.F.

   HideDlg( 1 )

   if ValType(oDlgRB[1]) <> "O"
      cAlias := cGetNewAlias( "CUST" )
      USE CUSTOMER NEW ALIAS (cAlias) SHARED VIA "DBFCDX"
      SET ORDER TO TAG FIRST
      GO TOP
      aGrad := { { 0.5, RGB( 140,  56,   6 ), RGB( 237, 234, 109 ) }, ;
                 { 0.5, RGB( 237, 234, 109 ), RGB(  85,  62,  84 ) } }
      oBmpAlpha1:=TImage():Define(, "logofive1.bmp" )
      oBmpAlpha2:=TImage():Define(, "logofive2.bmp" )
      DEFINE FONT oFont1 NAME "Arial" SIZE 0,-16 BOLD
      DEFINE BRUSH oBrush FILE "c:\fwh-908\Bitmaps\BackGrnd\Stone.bmp"
      DEFINE DIALOG oDlgRB[1] FROM 0,0 TO 538,782 OF oWnd:oWndClient PIXEL // COLORS RGB(0,0,0),RGB(255,255,255)
         oDlgRB[1]:nStyle := nOR(WS_CHILD) // ,WS_THICKFRAME
         oDlgRB[1]:oBrush := oBrush
         oDlgRB[1]:lTransparent := .T.

      @ 05,07 SAY "We are in DIALOG 01 of TAB 01" OF oDlgRB[1] PIXEL COLOR nRGB(0,0,125) FONT oFont1

      @ 16,07 GET oGet VAR cTxtGet OF oDlgRB[1] PIXEL

      @ 35,07 XBROWSE oBrw  ;
               COLUMNS "First", "City", "State", "Married", "HireDate", "Age", "Salary" ;
               COLSIZES nil,10 OF oDlgRB[1] ;
               SIZE 215,135 PIXEL ;
               ALIAS cAlias AUTOSORT FOOTERS LINES CELL ;
               BACKGROUND aGrad VERTICAL // NOBORDER

        oBrw:nStretchCol   := 2
        oBrw:Married:SetCheck( , .t. )

        oBrw:lTransparent := .T.
        oBrw:nStyle := nOr( WS_CHILD, WS_VISIBLE, WS_TABSTOP )

        WITH OBJECT oBrw:Salary
            :nTotal   := 0 ; :lTotal   := .t. ; :nEditType := EDIT_GET
        END

        oBrw:MakeTotals()
        oBrw:CreateFromCode()

      ACTIVATE DIALOG oDlgRB[1] NOWAIT ; //CENTERED
          ON INIT (oDlgRB[1]:Move(aCoords[1]+0,aCoords[2]+0,,,.T.));
          ON PAINT (ABPaint( hDC,452,260, oBmpAlpha1:hBitmap, 255 ),;
                    ABPaint( hDC,285,360, oBmpAlpha2:hBitmap, 255 ));
          VALID lEscapa
   else
      oDlgRB[1]:Show()
   endif
Return



Procedure Dialog02()
   LOCAL aCoords:=GetCoors(oWnd:oWndClient), oBrush, oGet, cTxtGet:="Get in Dialog 02"
   LOCAL oFont1, oBmpAlpha
   LOCAL lEscapa:=.F.

   HideDlg( 2 )

   if ValType(oDlgRB[2]) <> "O"
      oBmpAlpha:=TImage():Define(, "c:\fwh-908\Bitmaps\AlphaBmp\World.bmp" )
      DEFINE FONT oFont1 NAME "Arial" SIZE 0,-16 BOLD
      DEFINE BRUSH oBrush FILE "c:\fwh-908\Bitmaps\BackGrnd\Stone.bmp"
      DEFINE DIALOG oDlgRB[2] FROM 0,0 TO 538,782 OF oWnd:oWndClient PIXEL // COLORS RGB(0,0,0),RGB(255,255,255)
         oDlgRB[2]:nStyle := nOR(WS_CHILD) // ,WS_THICKFRAME
         oDlgRB[2]:oBrush := oBrush
         oDlgRB[2]:lTransparent := .T.

         @ 05,07 SAY "We are in DIALOG 02 of TAB 01" OF oDlgRB[2] PIXEL COLOR nRGB(0,0,125) FONT oFont1

         @ 16,07 GET oGet VAR cTxtGet OF oDlgRB[2] PIXEL

      ACTIVATE DIALOG oDlgRB[2] NOWAIT ; //CENTERED
          ON INIT (oDlgRB[2]:Move(aCoords[1]+0,aCoords[2]+0,,,.T.));
          ON PAINT (ABPaint( hDC,365,230, oBmpAlpha:hBitmap, 255 ));
          VALID lEscapa
   else
      oDlgRB[2]:Show()
   endif
Return




Procedure Dialog03()
   LOCAL aCoords:=GetCoors(oWnd:oWndClient), oBrush, oGet, cTxtGet:="Get in Dialog 03"
   LOCAL oFont1, oBmpAlpha
   LOCAL lEscapa:=.F.

   HideDlg( 3 )

   if ValType(oDlgRB[3]) <> "O"
      oBmpAlpha:=TImage():Define(, "c:\fwh-908\Bitmaps\AlphaBmp\World.bmp" )
      DEFINE FONT oFont1 NAME "Arial" SIZE 0,-16 BOLD
      DEFINE BRUSH oBrush FILE "c:\fwh-908\Bitmaps\BackGrnd\Stone.bmp"
      DEFINE DIALOG oDlgRB[3] FROM 0,0 TO 538,782 OF oWnd:oWndClient PIXEL // COLORS RGB(0,0,0),RGB(255,255,255)
         oDlgRB[3]:nStyle := nOR(WS_CHILD) // ,WS_THICKFRAME
         oDlgRB[3]:oBrush := oBrush
         oDlgRB[3]:lTransparent := .T.

         @ 05,07 SAY "We are in DIALOG 03 of TAB 01" OF oDlgRB[3] PIXEL COLOR nRGB(0,0,125) FONT oFont1

         @ 16,07 GET oGet VAR cTxtGet OF oDlgRB[3] PIXEL

      ACTIVATE DIALOG oDlgRB[3] NOWAIT ; //CENTERED
          ON INIT (oDlgRB[3]:Move(aCoords[1]+0,aCoords[2]+0,,,.T.));
          ON PAINT (ABPaint( hDC,395,260, oBmpAlpha:hBitmap, 255 ));
          VALID lEscapa
   else
      oDlgRB[3]:Show()
   endif
Return



Procedure Dialog04()
   LOCAL aCoords:=GetCoors(oWnd:oWndClient), oBrush, oGet, cTxtGet:="Get in Dialog 04"
   LOCAL oFont1, oBmpAlpha1, oBmpAlpha2
   LOCAL lEscapa:=.F.

   HideDlg( 4 )

   if ValType(oDlgRB[4]) <> "O"
      oBmpAlpha1:=TImage():Define(, "logofive1.bmp" )
      oBmpAlpha2:=TImage():Define(, "logofive2.bmp" )
      DEFINE FONT oFont1 NAME "Arial" SIZE 0,-18 BOLD
      DEFINE BRUSH oBrush FILE "c:\fwh-908\Bitmaps\BackGrnd\Wood.bmp"
      DEFINE DIALOG oDlgRB[4] FROM 0,0 TO 538,782 OF oWnd:oWndClient PIXEL // COLORS RGB(0,0,0),RGB(255,255,255)
         oDlgRB[4]:nStyle := nOR(WS_CHILD) // ,WS_THICKFRAME
         oDlgRB[4]:oBrush := oBrush
         oDlgRB[4]:lTransparent := .T.

         @ 40,40 SAY "We are in DIALOG 01 of TAB 02" OF oDlgRB[4] PIXEL COLOR nRGB(0,0,125) FONT oFont1

         @ 55,40 GET oGet VAR cTxtGet OF oDlgRB[4] PIXEL

      ACTIVATE DIALOG oDlgRB[4] NOWAIT ; //CENTERED
          ON INIT (oDlgRB[4]:Move(aCoords[1]+0,aCoords[2]+0,,,.T.));
          ON PAINT (ABPaint( hDC,452,260, oBmpAlpha1:hBitmap, 255 ),;
                    ABPaint( hDC,285,360, oBmpAlpha2:hBitmap, 255 ));
          VALID lEscapa
   else
      oDlgRB[4]:Show()
   endif
Return


Procedure Dialog05()
   LOCAL aCoords:=GetCoors(oWnd:oWndClient), oBrush, oGet, cTxtGet:="Get in Dialog 04"
   LOCAL oFont1, oBmpAlpha1, oBmpAlpha2
   LOCAL lEscapa:=.F.

   HideDlg( 5 )

   if ValType(oDlgRB[5]) <> "O"
      oBmpAlpha1:=TImage():Define(, "logofive1.bmp" )
      oBmpAlpha2:=TImage():Define(, "logofive2.bmp" )
      DEFINE FONT oFont1 NAME "Arial" SIZE 0,-18 BOLD
      DEFINE BRUSH oBrush FILE "c:\fwh-908\Bitmaps\BackGrnd\Wood.bmp"
      DEFINE DIALOG oDlgRB[5] FROM 0,0 TO 538,782 OF oWnd:oWndClient PIXEL // COLORS RGB(0,0,0),RGB(255,255,255)
         oDlgRB[5]:nStyle := nOR(WS_CHILD) // ,WS_THICKFRAME
         oDlgRB[5]:oBrush := oBrush
         oDlgRB[5]:lTransparent := .T.

         @ 40,40 SAY "We are in TAB 03" OF oDlgRB[5] PIXEL COLOR nRGB(0,0,125) FONT oFont1

         @ 55,40 GET oGet VAR cTxtGet OF oDlgRB[5] PIXEL

      ACTIVATE DIALOG oDlgRB[5] NOWAIT ; //CENTERED
          ON INIT (oDlgRB[5]:Move(aCoords[1]+0,aCoords[2]+0,,,.T.));
          ON PAINT (ABPaint( hDC,452,260, oBmpAlpha1:hBitmap, 255 ),;
                    ABPaint( hDC,285,360, oBmpAlpha2:hBitmap, 255 ));
          VALID lEscapa
   else
      oDlgRB[5]:Show()
   endif
Return



Procedure HideDlg( nDlg )
   LOCAL i:=1
   for i:=1 TO Len(oDlgRB)
       if ValType(oDlgRB[i])=="O"
          oDlgRB[i]:Hide()
       endif
   next
   if oRBar:nOption == 1
      nOptTab01 := nDlg
   elseif oRBar:nOption == 2
      nOptTab02 := nDlg
   elseif oRBar:nOption == 3
      nOptTab03 := nDlg
   endif
Return


FivetechSoft's AlphaBitamaps:
http://www.mastersoft3000.com/publico/logosfive.zip

Enjoy it :D

Best regards,

Carlos Gallego
Saludos,

Carlos Gallego

*** FWH-24.07, xHarbour 1.3.1 Build 20240624, Borland C++7.70, PellesC ***
Cgallegoa
 
Posts: 492
Joined: Sun Oct 16, 2005 3:32 am
Location: Quito - Ecuador

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 95 guests