Change size on a Ribbon Group

Change size on a Ribbon Group

Postby MdaSolution » Fri Jul 23, 2010 10:36 pm

I must change the size of a group of a Tab of RibbonBar

MENUITEM "Change Size" ACTION ( nwidthnew:= ChangeSize(oGrp:nWidth,"Change the size to group "+" ["+oGrp:cCaption+"]"),;
oGrp:End(),oGrp:=( oRBar:AddGroup(nwidthnew,cCaption,nGroup)),;
oRBar:Calcpos(), oRBar:display(),oRBar:refresh() )

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

ChangeSize function is a simply dialog with a get to change the number size
FWH .. BC582.. xharbour
User avatar
MdaSolution
 
Posts: 401
Joined: Tue Jan 05, 2010 2:33 pm

Re: Change size on a Ribbon Group

Postby ukoenig » Sat Jul 24, 2010 12:26 pm

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 )

Image

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 :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
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Change size on a Ribbon Group

Postby MdaSolution » Sat Jul 24, 2010 7:00 pm

UWE not use prg extern...

ogrp:SETSIZE (..) ...not run
ogrp:Move() not run

Also I reaprint the orbar with ::calcpos(),::display() but not run !!

try to set before 200 to nwidth of a group then try to insert a button ( trbtn ) and create an action
ACTION ( ogrp:nwidth:=300, ogrp:refresh(), orbar:calcpos(),orbar:display(),orbar:refresh()) NOT RUNor

ACTION ( ogrp:nwidth:=300, ogrp:setsize(,ogrp:nwidth), orbar:calcpos(),orbar:display(),orbar:refresh()) NOT RUN
FWH .. BC582.. xharbour
User avatar
MdaSolution
 
Posts: 401
Joined: Tue Jan 05, 2010 2:33 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Jimmy and 22 guests