Les dejo un ejemplo de la clase RibbonBar nativa de FWH. Espero les sirva.
- Code: Select all Expand view
- #include "fivewin.ch"
#include "ribbon.ch"
STATIC oWnd
STATIC oDlgRB[3]
function main()
local oRBar
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 oBtn21, oBtn22, oBtn23, oBtn24, oBtn25
local oBtn26, oBtn27, oBtn28, oBtn29, oBtn30
local oBtn31, oBtn32, oBtn33, oBtn34, oBtn35
LOCAL oSay1, oBmp, oFont1
LOCAL oCursor
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 130 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 oBtn2 GROUP oGr BITMAP "C:\FWH-908\bitmaps\cut16.BMP" ;
SIZE 75, 20 PROMPT "Dialog 01" MOSTLEFT round ;
action ( Dialog01() )
@ 24, 05 ADD BUTTON oBtn3 GROUP oGr BITMAP "C:\FWH-908\bitmaps\copy16.BMP" ;
SIZE 75, 20 PROMPT "Dialog 02" MOSTLEFT round ;
action( Dialog02() )
@ 46, 05 ADD BUTTON oBtn4 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 oBtn5 GROUP oGr1 BITMAP "C:\FWH-908\bitmaps\bold16.bmp" GROUPBUTTON FIRST SIZE 25, 20 ROUND ;
ACTION( oBtn5:lSelected := !oBtn5:lSelected )
@ 10, 30 ADD BUTTON oBtn6 GROUP oGr1 BITMAP "C:\FWH-908\bitmaps\italic16.bmp" GROUPBUTTON SIZE 25, 20 ROUND ;
ACTION( oBtn6:lSelected := !oBtn6:lSelected )
@ 10, 55 ADD BUTTON oBtn7 GROUP oGr1 BITMAP "C:\FWH-908\bitmaps\underline16.bmp" GROUPBUTTON SIZE 35, 20 ROUND Popup
@ 10, 90 ADD BUTTON oBtn8 GROUP oGr1 BITMAP "C:\FWH-908\bitmaps\strikethru16.bmp" GROUPBUTTON SIZE 25, 20 ROUND;
ACTION( oBtn8:lSelected := !oBtn8:lSelected )
@ 10, 115 ADD BUTTON oBtn9 GROUP oGr1 BITMAP "C:\FWH-908\bitmaps\subindex16.bmp" GROUPBUTTON SIZE 25, 20 ROUND;
ACTION( oBtn9:lSelected := !oBtn9:lSelected, oBtn10:lSelected := .f., oBtn10:Refresh() )
@ 10, 140 ADD BUTTON oBtn10 GROUP oGr1 BITMAP "C:\FWH-908\bitmaps\superindex16.bmp" GROUPBUTTON SIZE 25, 20 ROUND ;
ACTION( oBtn10:lSelected := !oBtn10:lSelected, oBtn9:lSelected := .f., oBtn9:Refresh() )
@ 10, 165 ADD BUTTON oBtn11 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 oBtn14 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 oBtn4 GROUP oGr2 BITMAP "C:\FWH-908\bitmaps\32x32\quit.BMP" ;
SIZE 34,52 PROMPT "Exit" action( oWnd:End())
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()
return nil
Procedure Dialog01()
LOCAL aCoords:=GetCoors(oWnd:oWndClient), oBrush, oGet, cTxtGet:="Get in Dialog 01"
LOCAL oFont1, oBmpAlpha
LOCAL lEscapa:=.F.
HideDlg( 1 )
if ValType(oDlgRB[1]) <> "O"
oBmpAlpha:=TImage():Define(, "c:\fwh-908\Bitmaps\AlphaBmp\World.bmp" )
DEFINE FONT oFont1 NAME "Ms Sans Serif" SIZE 0,-8 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.
@ 20,20 SAY "Some text bla bla bla in DIALOG 01" OF oDlgRB[1] PIXEL COLOR nRGB(0,0,125) FONT oFont1
@ 35,20 GET oGet VAR cTxtGet OF oDlgRB[1] PIXEL
ACTIVATE DIALOG oDlgRB[1] NOWAIT ; //CENTERED
ON INIT (oDlgRB[1]:Move(aCoords[1]+0,aCoords[2]+0,,,.T.));
ON PAINT (ABPaint( hDC,335,200, oBmpAlpha: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 "Ms Sans Serif" SIZE 0,-8 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.
@ 30,30 SAY "Some text bla bla bla in DIALOG 02" OF oDlgRB[2] PIXEL COLOR nRGB(0,0,125) FONT oFont1
@ 45,30 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 "Ms Sans Serif" SIZE 0,-8 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.
@ 40,40 SAY "Some text bla bla bla in DIALOG 03" OF oDlgRB[3] PIXEL COLOR nRGB(0,0,125) FONT oFont1
@ 55,40 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 HideDlg( nDlg )
LOCAL i:=1
for i:=1 TO Len(oDlgRB)
if ValType(oDlgRB[i])=="O"
oDlgRB[i]:Hide()
endif
next
Return
Saludos,
Carlos Gallego