With the first Release of the Ribbonbar-Class < 08.2009 >
I started with a Painter, but stopped the work on it.
I understood I must destroy the group and add a new group with the same nIndex ( number of Goup)
oGrp:End(),oGrp:=( oRBar:AddGroup(nwidthnew,cCaption,nGroup)),;
but
with oGrp:End() the ribbonbar make error ....or there is a bug on the ribbonbar class I repainted the complete Ribbonbar on a Button-Action after changes !My Solution :
A painted Ribbonbar on the Main-Window.
A Tool-window with Folders, to add / change Settings. ( the same Logic, I use in all my other tools )
With a Draw-button, I distroyed and repainted the Ribbonbar with the new Settings on the Main-Window.
It works fine and I could add / resize Tabs, Groups , changing Colors .....
I think, to change / add something from inside the Ribbonbar, doesn't work and is to difficult to manage.
As soon You want to create a PRG- and EXE-File, You have to define a Preview-Function of a Window
with the Ribbonbar and the used Vars from the Folderpages.
( On the bottom of this post You can see, how to do it ( a Part of Code-Creation from the Button-Tools )
Maybe it gives You a Idea, how to create it.
Creating PRG- and EXE-File ( it is not easy and takes some Time )
- Code: Select all Expand view
FUNCTION MAKE_EXE()
// c_path := CURDRIVE() + ":\" + GETCURDIR()
IF FILE (c_path + "\PROJECT.PRG")
DELETE FILE c_path + "\PROJECT.PRG"
ENDIF
IF FILE (c_path + "\PROJECT.EXE")
DELETE FILE c_path + "\PROJECT.EXE"
ENDIF
// create the PRG
DO_SOURCE()
IF FILE ( c_path + "\PROJECT.PRG" )
// File exists open with Editor
WAITRUN( "Angelwriter.exe " + c_path + "\PROJECT.prg" ) // copy from .PRG
// Close Editor and create EXE-File
IF MsgYesNo( "Do you want to Create / Run : PROJECT.exe ?","PROJECT")
WAITRUN( "GO.BAT" ) // the LINK-File !!!!
IF FILE ( c_path + "\PROJECT.EXE" )
WINEXEC( c_path + "\PROJECT.EXE" )
ELSE
MsgAlert( "The file : PROJECT.EXE " + CRLF + ;
"is not created !","Error" )
ENDIF
ENDIF
ELSE
MsgAlert( "The File : " + CRLF + ;
"PROJECT.PRG" + CRLF + ;
"is not created !", "Error" )
ENDIF
SYSREFRESH()
RETURN NIL
// ------- The Main-Window with Exit-Button --------------------------------
FUNCTION DO_SOURCE()
oText := TTxtFile():New( c_path + "\PROJECT.PRG" )
IF oText:Open()
oText:Add('#include "FiveWin.ch"')
oText:Add('#include "Image.ch"')
oText:Add("")
oText:Add("static oWnd, oButtFont, oSkinB" )
oText:Add("")
oText:Add("FUNCTION Main()")
oText:Add('LOCAL oBtn1, oBtn2, hDC, oBrush, oImage')
oText:Add("LOCAL nWidth := GetSysMetrics(0)")
oText:Add("LOCAL nHeight := GetSysMetrics(1)")
oText:Add("")
oText:Add("SET _3DLOOK ON" )
oText:Add("SetBalloon( .T. )" )
oText:Add('c_path := CURDRIVE() + ":\" + GETCURDIR()')
oText:Add('oProgFont := TFont():New("Arial", ,-14,.F.,.F. , , , ,.F. ) ')
oText:Add("")
oText:Add("")
oText:Add('DEFINE WINDOW oWnd TITLE "Buttonbar- and Button-Test" ')
oText:Add("")
oText:Add('oButtFont := TFont():New("Arial",0,-16,.F.,.T.,0,0,0,.T. ) ')
oText:Add('DEFINE IMAGE oImage FILENAME c_path + "\Images\BACKGRD.JPG" ')
oText:Add("")
oText:Add("@ nHeight - 160, nWidth - 420 BTNBMP oBtn1 SIZE 200, 60 OF oWnd 2007 ;" )
oText:Add('FILENAME c_path + "\Images\select.bmp" ;')
oText:Add("LEFT ;" )
oText:Add('PROMPT " &Preview Buttons " ; ')
oText:Add("FONT oButtFont ;" )
oText:Add("ACTION Buttons(oWnd)" )
oText:Add("oBtn1:lTransparent = .t. " )
oText:Add('oBtn1:cTooltip := { "Open" + CRLF + ;')
oText:Add(' "the Button-Test","Button-Test", 1, CLR_BLACK, 14089979 }' )
oText:Add("")
oText:Add("@ nHeight - 160, nWidth - 200 BTNBMP oBtn2 SIZE 150, 60 OF oWnd 2007 ;" )
oText:Add('FILENAME c_path + "\Images\exit.bmp" ;' )
oText:Add("LEFT ;" )
oText:Add('PROMPT " &Exit " ;' )
oText:Add("FONT oButtFont ;" )
oText:Add("ACTION oWnd:End()" )
oText:Add("oBtn2:lTransparent = .t." )
oText:Add('oBtn2:cTooltip := { "Close" + CRLF + ;' )
oText:Add(' "the VTitle-Painter","Close Window", 1, CLR_BLACK, 14089979 }' )
oText:Add("")
oText:Add('ACTIVATE WINDOW oWnd MAXIMIZED ;')
oText:Add('ON PAINT ( DRAWBITMAP( hdc, oImage:hbitmap, 0, 0, nWidth, nHeight ) ) ;')
oText:Add('VALID MsgYesNo( "Do you want to end?" )')
oText:Add("")
oText:Add("oProgFont:End()")
oText:Add("oButtFont:End()")
oText:Add("")
oText:Add('RETURN( NIL )')
....
....
....
// Call any Functions You need
BAR_PART( oText )
....
oText:Close()
ENDIF
RETURN( NIL )
// -- Numeric Vars use like ( Position ) : oText:Add("@ " + ALLTRIM(STR(nTop)) + ',' + ALLTRIM(STR(nLeft)) ...
// ---------------------------------------
FUNCTION BAR_PART( oText )
oText:Add("" )
oText:Add('// ------------- Buttonbar --------------------------------------' )
oText:Add("" )
oText:Add("FUNCTION MAKEBBAR(oDlg, oTextFont)")
oText:Add("LOCAL oBar, oButt1, oButt2, oButt3, oButt4, oButt5, oButt6, oButt7")
oText:Add("" )
oText:Add("DEFINE BUTTONBAR oBar OF oDlg SIZE " + ALLTRIM(STR(B_WIDTH)) + "," + ALLTRIM(STR(B_HEIGHT)) + " 3DLOOK 2007 TOP" )
...
...
oText:Add("RETURN NIL" )
RETURN ( NIL )
Best Regards
Uwe