Changing Ribbon on opening a MDI-Child

Changing Ribbon on opening a MDI-Child

Postby gkuhnert » Fri Jul 02, 2010 9:17 am

Hi,

when opening a mdi-child I'd like to change the appearance of my ribbon-menu.
I try to redefine my ribbon-menu, but when the menu is being painted, it doesn't look right. A half button appears, but without any functionality.

Is there a malfunction in painting a new ribbon? Or won't this approach work at all?

This is my source code:
Code: Select all  Expand view  RUN
#include "FiveWin.ch"
#INCLUDE "ribbon.CH"

static oWnd, oRb

//----------------------------------------------------------------------------//

function Main()

   DEFINE WINDOW oWnd FROM 1, 1 To 42, 105 ;
      TITLE "This is a MDI enviroment" MDI VSCROLL

    oWnd:bGotFocus := {|| oRb := nil, ribbon_menu() }
    oWnd:bInit := {|| oRb := nil, ribbon_menu() }

   ACTIVATE WINDOW oWnd

return nil

//----------------------------------------------------------------------------//

// First MDI-Child
function Create1()

   local oWndChild, oIcon

   DEFINE ICON oIcon RESOURCE "test"
   DEFINE WINDOW oWndChild MDICHILD OF oWnd ICON oIcon

    // Build the Ribbon for "MDI1"
   oWndChild:bGotFocus  = {|| ribbon_menu("mdi1") }
    oWndChild:bInit := {|| ribbon_menu("mdi1") }

   ACTIVATE WINDOW oWndChild

return nil

// Second MDI-Child
function Create2()

   local oWndChild, oIcon

   DEFINE ICON oIcon RESOURCE "test"
   DEFINE WINDOW oWndChild MDICHILD OF oWnd ICON oIcon

    // Build the Ribbon for "MDI2"
   oWndChild:bGotFocus  = {|| ribbon_menu("mdi2") }
    oWndChild:bInit  = {|| ribbon_menu("mdi2") }

   ACTIVATE WINDOW oWndChild

return nil


FUNCTION Ribbon_Menu(cWindow)
    local oGr1, oGr2
    local oBackBtn, oBtn[4]
    local oBackstage
    local aClrMenu1 := { { 0.5, RGB( 69, 124, 188 ), RGB( 41, 93, 171 ) }, { 0.5, RGB( 26, 64, 136 ), RGB( 56, 135, 191 ) } }
    local aClrMenu2 := { { 0.5, RGB( 123, 178, 236 ), RGB( 71, 126, 205 ) }, { 0.5, RGB( 17, 78, 175 ), RGB( 128, 225, 255 ) } }

    default cWindow := ""
    oRb := nil
    oRb := TRibbonBar():New(oWnd, {"Folder 1","Folder 2"}, ,,,125,26)
   oRb:nLeftMargin = 85 //97

   oBackBtn = TRBtn():New( 4, 0, 70, 20, "./../bitmaps/rbnmenu.bmp", { || oRB:Backstage() }, oRB,;
        ,,,,,, .T., .T.,,,,,, /*"POPUP"*/ , oBackstage,,,,,,,,,,,,, aClrMenu1, nRGB( 125, 172, 215 ),;
      nRGB( 65, 106, 189 ) )

    ADD GROUP oGr1 RIBBON oRB TO OPTION 1 PROMPT "Group1" WIDTH 140
        @ 5,5   ADD BUTTON oBtn[1] PROMPT "Window 1"    BITMAP ""       GROUP oGr1 ROUND SIZE 63,65 ACTION Create1()
        @ 5,70  ADD BUTTON oBtn[2] PROMPT "Window 2"    BITMAP ""       GROUP oGr1 ROUND SIZE 63,65 ACTION Create2()

    // Special Ribbon-Menu for "MDI1"
    IF cWindow = "mdi1"
        ADD GROUP oGr2 RIBBON oRB TO OPTION 1 PROMPT "Group3b" WIDTH 80
            @ 5,5   ADD BUTTON oBtn[3] PROMPT "MDI-button (1)" BITMAP ""    GROUP oGr2 ROUND SIZE 63,65 ACTION Msginfo("mdi1 button")

    // Special Ribbon-Menu for "MDI2"
    ELSEIF cWindow = "mdi2"
        ADD GROUP oGr2 RIBBON oRB TO OPTION 1 PROMPT "Group3c" WIDTH 140
            @ 5,5   ADD BUTTON oBtn[3] PROMPT "MDI-button (2)" BITMAP ""    GROUP oGr2 ROUND SIZE 63,65 ACTION Msginfo("mdi2 button1")
            @ 5,70  ADD BUTTON oBtn[4] PROMPT "MDI-button (2)" BITMAP ""    GROUP oGr2 ROUND SIZE 63,65 ACTION Msginfo("mdi2 button2")

    ENDIF

    DEFINE BACKSTAGE oBackstage MAINWIDTH 800
    DEFINE BSSELECT OF oBackstage PROMPT "Test1" ACTION Msginfo("Test1")
    DEFINE BSSELECT OF oBackstage PROMPT "Test2" ACTION Msginfo("Test2")
    SET BACKSTAGE oBackstage TO oRb

    oRb:CalcPos()
    oRb:Refresh()

return nil


//----------------------------------------------------------------------------//

procedure AppSys  // XBase++ requirements
return

//----------------------------------------------------------------------------//
 
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Re: Changing Ribbon on opening a MDI-Child

Postby gkuhnert » Fri Jul 02, 2010 1:10 pm

This is how it looks on start of the program:

Image

And this how it looks after opening the first mdichild:

Image
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Re: Changing Ribbon on opening a MDI-Child

Postby Antonio Linares » Fri Jul 02, 2010 4:18 pm

Gilbert,

You were not properly destroying the previously created RibbonBar (so a new one was created on top of the previous one, again and again), also the RibbonBar was using a wrong width.

Your example, modified this way, seems to be working fine :-)

ribbon3.prg
Code: Select all  Expand view  RUN
#include "FiveWin.ch"
#INCLUDE "ribbon.CH"

static oWnd, oRb

//----------------------------------------------------------------------------//

function Main()

   DEFINE WINDOW oWnd FROM 1, 1 To 42, 105 ;
      TITLE "This is a MDI enviroment" MDI VSCROLL

    oWnd:bInit := {|| ribbon_menu() }

   ACTIVATE WINDOW oWnd

return nil

//----------------------------------------------------------------------------//

// First MDI-Child
function Create1()

   local oWndChild, oIcon

   DEFINE ICON oIcon RESOURCE "test"

   DEFINE WINDOW oWndChild MDICHILD OF oWnd ICON oIcon

   // Build the Ribbon for "MDI1"
   oWndChild:bGotFocus  = {|| ribbon_menu("mdi1") }
   oWndChild:bInit := {|| ribbon_menu("mdi1") }
   
   ACTIVATE WINDOW oWndChild ;
      VALID ( oWndChild:bGotFocus := nil, ribbon_menu(), .T. )
     
return nil

// Second MDI-Child
function Create2()

   local oWndChild, oIcon

   DEFINE ICON oIcon RESOURCE "test"
   
   DEFINE WINDOW oWndChild MDICHILD OF oWnd ICON oIcon

   // Build the Ribbon for "MDI2"
   oWndChild:bGotFocus  = {|| ribbon_menu("mdi2") }
   oWndChild:bInit  = {|| ribbon_menu("mdi2") }

   ACTIVATE WINDOW oWndChild ;
      VALID ( oWndChild:bGotFocus := nil, ribbon_menu(), .T. )
     
return nil


FUNCTION Ribbon_Menu(cWindow)

    local oGr1, oGr2
    local oBackBtn, oBtn[4]
    local oBackstage
    local aClrMenu1 := { { 0.5, RGB( 69, 124, 188 ), RGB( 41, 93, 171 ) }, { 0.5, RGB( 26, 64, 136 ), RGB( 56, 135, 191 ) } }
    local aClrMenu2 := { { 0.5, RGB( 123, 178, 236 ), RGB( 71, 126, 205 ) }, { 0.5, RGB( 17, 78, 175 ), RGB( 128, 225, 255 ) } }

    default cWindow := ""
   
    if oRb != nil
       oRb:End()
       oRB = nil
    endif
       
    oRb := TRibbonBar():New(oWnd, {"Folder 1","Folder 2"}, ,, oWnd:nWidth, 125, 26 )
    oRb:nLeftMargin = 85
    oRb:CalcPos()

   oBackBtn = TRBtn():New( 4, 0, 70, 20, "./../bitmaps/rbnmenu.bmp", { || oRB:Backstage() }, oRB,;
        ,,,,,, .T., .T.,,,,,, /*"POPUP"*/ , oBackstage,,,,,,,,,,,,, aClrMenu1, nRGB( 125, 172, 215 ),;
      nRGB( 65, 106, 189 ) )

    ADD GROUP oGr1 RIBBON oRB TO OPTION 1 PROMPT "Group1" WIDTH 140
        @ 5,5   ADD BUTTON oBtn[1] PROMPT "Window 1"    BITMAP ""       GROUP oGr1 ROUND SIZE 63,65 ACTION Create1()
        @ 5,70  ADD BUTTON oBtn[2] PROMPT "Window 2"    BITMAP ""       GROUP oGr1 ROUND SIZE 63,65 ACTION Create2()

    // Special Ribbon-Menu for "MDI1"
    IF cWindow = "mdi1"
        ADD GROUP oGr2 RIBBON oRB TO OPTION 1 PROMPT "Group3b" WIDTH 80
            @ 5,5   ADD BUTTON oBtn[3] PROMPT "MDI-button (1)" BITMAP ""    GROUP oGr2 ROUND SIZE 63,65 ACTION Msginfo("mdi1 button")

    // Special Ribbon-Menu for "MDI2"
    ELSEIF cWindow = "mdi2"
        ADD GROUP oGr2 RIBBON oRB TO OPTION 1 PROMPT "Group3c" WIDTH 140
            @ 5,5   ADD BUTTON oBtn[3] PROMPT "MDI-button (2)" BITMAP ""    GROUP oGr2 ROUND SIZE 63,65 ACTION Msginfo("mdi2 button1")
            @ 5,70  ADD BUTTON oBtn[4] PROMPT "MDI-button (2)" BITMAP ""    GROUP oGr2 ROUND SIZE 63,65 ACTION Msginfo("mdi2 button2")

    ENDIF

    DEFINE BACKSTAGE oBackstage MAINWIDTH 800
    DEFINE BSSELECT OF oBackstage PROMPT "Test1" ACTION Msginfo("Test1")
    DEFINE BSSELECT OF oBackstage PROMPT "Test2" ACTION Msginfo("Test2")
    SET BACKSTAGE oBackstage TO oRb

return nil

//----------------------------------------------------------------------------//
 

Anyhow, if you just want to change some groups, it should be better not to the destroy the RibbonBar. Instead of that, just remove the no longer needed groups and add the new ones. That should avoid flickering.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Changing Ribbon on opening a MDI-Child

Postby Antonio Linares » Fri Jul 02, 2010 9:12 pm

screenshot:

Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Changing Ribbon on opening a MDI-Child

Postby Antonio Linares » Fri Jul 02, 2010 9:21 pm

Removing the top pulldown menu:
Code: Select all  Expand view  RUN

   ...
   DEFINE WINDOW oWnd FROM 1, 1 TO 42, 105 ;
      TITLE "This is a MDI enviroment" MDI VSCROLL

   oWnd:oMenu:End()
   ...
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Changing Ribbon on opening a MDI-Child

Postby gkuhnert » Sat Jul 03, 2010 11:31 am

Antonio,

that looks terrific, just what I needed. I'll try it as soon as I'm in the office on monday. Thank you very much! :D
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Re: Changing Ribbon on opening a MDI-Child

Postby gkuhnert » Tue Jul 06, 2010 2:30 pm

Antonio,

Antonio Linares wrote:Anyhow, if you just want to change some groups, it should be better not to the destroy the RibbonBar. Instead of that, just remove the no longer needed groups and add the new ones. That should avoid flickering.


How do I properly remove no longer needed groups?
my goal: only the rbgroup that belongs to the mdi child with focus should be visible (together with some standard-rbgroups of course).

It seems following calls won't work:
Code: Select all  Expand view  RUN
oGroup1:Destroy()
oGroup1 := nil


Complete example:
Code: Select all  Expand view  RUN
#include "FiveWin.ch"
#INCLUDE "ribbon.CH"

static oWnd, oRb
static osGroup1, osGroup2
static oWndChild1, oWndChild2

// Main Function ---------------------------------------------------------------------//

function Main()

   DEFINE WINDOW oWnd FROM 1, 1 To 42, 105 ;
      TITLE "This is a MDI enviroment" MDI VSCROLL

   oWnd:bInit := {|| ribbon_menu() }

   ACTIVATE WINDOW oWnd

return nil


// MDI-Children ------------------------------------------------------ //
function Create1()

   local oIcon

   DEFINE ICON oIcon RESOURCE "test"
   DEFINE WINDOW oWndChild1 MDICHILD OF oWnd ICON oIcon

   // Build the Ribbon for "MDI1"
   //oWndChild1:bGotFocus  = {|| AddGroup(1) }
   oWndChild1:bInit := {|| AddGroup(1) }
   //oWndChild1:bLostFocus  = {|| RemoveGroup(1) }

   ACTIVATE WINDOW oWndChild1 ;
      VALID ( oWndChild1:bGotFocus := nil, RemoveGroup(1) /* ribbon_menu() */ , .T. )

return nil


function Create2()

   local oIcon

   DEFINE ICON oIcon RESOURCE "test"
    DEFINE WINDOW oWndChild2 MDICHILD OF oWnd ICON oIcon

   // Build the Ribbon for "MDI2"
   oWndChild2:bGotFocus  = {|| AddGroup(2) }
   oWndChild2:bInit  = {|| AddGroup(2) }
   oWndChild2:bLostFocus  = {|| RemoveGroup(2) }

   ACTIVATE WINDOW oWndChild2 ;
      VALID ( oWndChild2:bGotFocus := nil, RemoveGroup(2) /*ribbon_menu() */ , .T. )

return nil


// Building the ribbon --------------------------------------------------------------//
FUNCTION Ribbon_Menu(cWindow)
    local oGr1, oGr2
    local oBackBtn, oBtn[4]
    local oBackstage
    local aClrMenu1 := { { 0.5, RGB( 69, 124, 188 ), RGB( 41, 93, 171 ) }, { 0.5, RGB( 26, 64, 136 ), RGB( 56, 135, 191 ) } }
    local aClrMenu2 := { { 0.5, RGB( 123, 178, 236 ), RGB( 71, 126, 205 ) }, { 0.5, RGB( 17, 78, 175 ), RGB( 128, 225, 255 ) } }

    default cWindow := ""

    if oRb != nil
       oRb:End()
       oRB = nil
    endif

    oRb := TRibbonBar():New(oWnd, {"Folder 1","Folder 2"}, ,, oWnd:nWidth, 125, 26 )
    oRb:nLeftMargin = 85
    oRb:CalcPos()

   oBackBtn = TRBtn():New( 4, 0, 70, 20, "./../bitmaps/rbnmenu.bmp", { || oRB:Backstage() }, oRB,;
        ,,,,,, .T., .T.,,,,,, /*"POPUP"*/ , oBackstage,,,,,,,,,,,,, aClrMenu1, nRGB( 125, 172, 215 ),;
      nRGB( 65, 106, 189 ) )

    ADD GROUP oGr1 RIBBON oRB TO OPTION 1 PROMPT "GroupMain" WIDTH 140
        @ 5,5   ADD BUTTON oBtn[1] PROMPT "Window 1"    BITMAP ""       GROUP oGr1 ROUND SIZE 63,65 ACTION Create1()
        @ 5,70  ADD BUTTON oBtn[2] PROMPT "Window 2"    BITMAP ""       GROUP oGr1 ROUND SIZE 63,65 ACTION Create2()

    DEFINE BACKSTAGE oBackstage MAINWIDTH 800
    DEFINE BSSELECT OF oBackstage PROMPT "Test1" ACTION Msginfo("Test1")
    DEFINE BSSELECT OF oBackstage PROMPT "Test2" ACTION Msginfo("Test2")
    SET BACKSTAGE oBackstage TO oRb
return nil


// Adding and removing groups --------------------------------------------- //
FUNCTION AddGroup(nGroup)
    IF nGroup == 1 .AND. osGroup1 == nil
    ADD GROUP osGroup1 RIBBON oRB TO OPTION 1 PROMPT "Group1" WIDTH 140
          @ 5,5   ADD BUTTON PROMPT "MDI-button (1)" BITMAP ""    GROUP osGroup1 ROUND SIZE 63,65 ACTION Msginfo("mdi1 button1")
       @ 5,70  ADD BUTTON PROMPT "MDI-button (2)" BITMAP ""    GROUP osGroup1 ROUND SIZE 63,65 ACTION Msginfo("mdi1 button2")
    ELSEIF nGroup == 2 .AND. osGroup2 == nil
        ADD GROUP osGroup2 RIBBON oRB TO OPTION 1 PROMPT "Group2" WIDTH 200
          @ 5,5   ADD BUTTON PROMPT "MDI-button (3)" BITMAP ""    GROUP osGroup2 ROUND SIZE 63,65 ACTION Msginfo("mdi2 button1")
       @ 5,70  ADD BUTTON PROMPT "MDI-button (4)" BITMAP ""    GROUP osGroup2 ROUND SIZE 63,65 ACTION Msginfo("mdi2 button2")
            @ 5,135 ADD BUTTON PROMPT "MDI-button (5)" BITMAP ""    GROUP osGroup2 ROUND SIZE 63,65 ACTION Msginfo("mdi2 button3")
    ENDIF

    oRb:CalcPos()
    oRb:Refresh()
return nil


FUNCTION RemoveGroup(nGroup)
    IF nGroup == 1 .AND. osGroup1 != nil
        osGroup1:Destroy()
        osGroup1 := nil
    ELSEIF nGroup == 2 .AND. osGroup2 != nil
        osGroup2:Destroy()
        osGroup2 := nil
    ENDIF
    oRb:CalcPos()
    oRb:Refresh()
return nil
 
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Re: Changing Ribbon on opening a MDI-Child

Postby Antonio Linares » Tue Jul 06, 2010 5:31 pm

Gilbert,

Please try with oGroup1:End() instead of oGroup1:Destroy()

Method Destroy() usually should never be called directly. It is automatically called by Windows to clean no longer needed resources. Method End() starts the process to end and destroy an object.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Changing Ribbon on opening a MDI-Child

Postby gkuhnert » Wed Jul 07, 2010 10:14 am

Antonio,

thanks, with :end() is working. But now I've got a paint-problem:
At adding and removing the mdi-child I tried a oRb:Refresh() as well as a oRb:Paint() but I always loose the background. After resizing the main window It also seems that the background colors of the main group disappear as well.

After opening the mdi-child:
Image

After closing the mdi-child:
Image

After resizing the main window:
Image
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Re: Changing Ribbon on opening a MDI-Child

Postby Antonio Linares » Wed Jul 07, 2010 11:47 am

Gilbert,

Please post your most recent example code so we try it here, thanks :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Changing Ribbon on opening a MDI-Child

Postby gkuhnert » Wed Jul 07, 2010 12:06 pm

Antonio,

here the code:

Code: Select all  Expand view  RUN
#include "FiveWin.ch"
#INCLUDE "ribbon.CH"

static oWnd, oRb
static osGroup1, osGroup2
static oWndChild1, oWndChild2

// Main Function ---------------------------------------------------------------------//

function Main()

   DEFINE WINDOW oWnd FROM 1, 1 To 42, 105 ;
      TITLE "This is a MDI enviroment" MDI VSCROLL

   ACTIVATE WINDOW oWnd ON INIT ribbon_menu()

return nil


// MDI-Children ------------------------------------------------------ //
function Create1()
   local oIcon

   DEFINE ICON oIcon RESOURCE "test"
   DEFINE WINDOW oWndChild1 MDICHILD OF oWnd ICON oIcon

   // Add the ribbongroup for "MDI1"
   oWndChild1:bInit := {|| AddGroup(1) }

   ACTIVATE WINDOW oWndChild1 ;
      VALID ( oWndChild1:bGotFocus := nil, RemoveGroup(1), .T. )

return nil


function Create2()
   local oIcon

   DEFINE ICON oIcon RESOURCE "test"
    DEFINE WINDOW oWndChild2 MDICHILD OF oWnd ICON oIcon

   // Add the ribbongroup for "MDI1"
   oWndChild2:bInit  = {|| AddGroup(2) }

   ACTIVATE WINDOW oWndChild2 ;
      VALID ( oWndChild2:bGotFocus := nil, RemoveGroup(2), .T. )

return nil


// Building the ribbon --------------------------------------------------------------//
FUNCTION Ribbon_Menu(cWindow)
    local oGr1, oGr2
    local oBackBtn, oBtn[4]
    local oBackstage
    local aClrMenu1 := { { 0.5, RGB( 69, 124, 188 ), RGB( 41, 93, 171 ) }, { 0.5, RGB( 26, 64, 136 ), RGB( 56, 135, 191 ) } }
    local aClrMenu2 := { { 0.5, RGB( 123, 178, 236 ), RGB( 71, 126, 205 ) }, { 0.5, RGB( 17, 78, 175 ), RGB( 128, 225, 255 ) } }
    default cWindow := ""

   if oRb != nil
    oRb:End()
      oRB = nil
   endif

   oRb := TRibbonBar():New(oWnd, {"Folder 1","Folder 2"}, ,, oWnd:nWidth, 125, 26 )
   oRb:nLeftMargin = 85
   oRb:CalcPos()

    oBackBtn = TRBtn():New( 4, 0, 70, 20, "./../bitmaps/rbnmenu.bmp", { || oRB:Backstage() }, oRB,;
        ,,,,,, .T., .T.,,,,,, /*"POPUP"*/ , oBackstage,,,,,,,,,,,,, aClrMenu1, nRGB( 125, 172, 215 ),;
      nRGB( 65, 106, 189 ) )

    ADD GROUP oGr1 RIBBON oRB TO OPTION 1 PROMPT "GroupMain" WIDTH 140
        @ 5,5   ADD BUTTON oBtn[1] PROMPT "Window 1"    BITMAP ""       GROUP oGr1 ROUND SIZE 63,65 ACTION Create1()
        @ 5,70  ADD BUTTON oBtn[2] PROMPT "Window 2"    BITMAP ""       GROUP oGr1 ROUND SIZE 63,65 ACTION Create2()

    DEFINE BACKSTAGE oBackstage MAINWIDTH 800
    DEFINE BSSELECT OF oBackstage PROMPT "Test1" ACTION Msginfo("Test1")
    DEFINE BSSELECT OF oBackstage PROMPT "Test2" ACTION Msginfo("Test2")
    SET BACKSTAGE oBackstage TO oRb
return nil


// Adding and removing groups --------------------------------------------- //
FUNCTION AddGroup(nGroup)
    IF nGroup == 1 .AND. osGroup1 == nil
    ADD GROUP osGroup1 RIBBON oRB TO OPTION 1 PROMPT "Group1" WIDTH 140
          @ 5,5   ADD BUTTON PROMPT "MDI-button (1)" BITMAP ""    GROUP osGroup1 ROUND SIZE 63,65 ACTION Msginfo("mdi1 button1")
       @ 5,70  ADD BUTTON PROMPT "MDI-button (2)" BITMAP ""    GROUP osGroup1 ROUND SIZE 63,65 ACTION Msginfo("mdi1 button2")
    ELSEIF nGroup == 2 .AND. osGroup2 == nil
        ADD GROUP osGroup2 RIBBON oRB TO OPTION 1 PROMPT "Group2" WIDTH 200
          @ 5,5   ADD BUTTON PROMPT "MDI-button (3)" BITMAP ""    GROUP osGroup2 ROUND SIZE 63,65 ACTION Msginfo("mdi2 button1")
       @ 5,70  ADD BUTTON PROMPT "MDI-button (4)" BITMAP ""    GROUP osGroup2 ROUND SIZE 63,65 ACTION Msginfo("mdi2 button2")
            @ 5,135 ADD BUTTON PROMPT "MDI-button (5)" BITMAP ""    GROUP osGroup2 ROUND SIZE 63,65 ACTION Msginfo("mdi2 button3")
    ENDIF

    oRb:CalcPos()
    oRb:Display()
    oRb:Refresh()
return nil


FUNCTION RemoveGroup(nGroup)
    IF nGroup == 1 .AND. osGroup1 != nil
        osGroup1:End()
        osGroup1 := nil
    ELSEIF nGroup == 2 .AND. osGroup2 != nil
        osGroup2:End()
        osGroup2 := nil
    ENDIF
    oRb:CalcPos()
    oRb:Display()
    oRb:Refresh()
return nil
 
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Re: Changing Ribbon on opening a MDI-Child

Postby Antonio Linares » Wed Jul 07, 2010 12:44 pm

Gilbert,

Fixed. A required change was needed in Class TRibbonBar :-)

We email you a modified TRibbon.prg.

We will include these changes in FWH 10.7
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Changing Ribbon on opening a MDI-Child

Postby gkuhnert » Wed Jul 07, 2010 2:03 pm

Antonio,

thanks a lot for your quick support :D

Now it seems to be working just fine.

Can I assume that this correction automatically will be included in the next build of fwh?
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Re: Changing Ribbon on opening a MDI-Child

Postby Antonio Linares » Wed Jul 07, 2010 2:09 pm

Gilbert,

yes, I told you in my previous post :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Changing Ribbon on opening a MDI-Child

Postby Raymundo Islas M. » Sat Aug 24, 2013 12:24 am

Antonio,

What if I need to change the whole Ribbon for a new one with different groups and buttons.
How can I achieve this process ?

This looks really good, but in my case if I click on some app's module, all options at ribbon are different.

Thanks a lot
FWH 10.6 + xHarbour + Borland 582
User avatar
Raymundo Islas M.
 
Posts: 592
Joined: Tue Mar 14, 2006 11:34 pm
Location: Acapulco, Gro. MEXICO


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 95 guests