RibbonBar

RibbonBar

Postby Enrico Maria Giordano » Fri May 31, 2013 10:49 am

Dear friends, I'm trying to use the ribbonbar. First problem: why the buttons in the second tab are taller than the ones in the first tab? What I would want to achieve is a series of toolbars switched by tabs.

Code: Select all  Expand view
#include "Fivewin.ch"
#include "Ribbon.ch"


FUNCTION MAIN()

    LOCAL oDlg

    DEFINE DIALOG oDlg;
           SIZE 800, 600

    ACTIVATE DIALOG oDlg;
             ON INIT MAKERIBBON( oDlg );
             CENTER

    RETURN NIL


STATIC FUNCTION MAKERIBBON( oDlg )

    LOCAL oRib

    LOCAL oGr1, oGr2, oGr3, oGr4

    LOCAL oMn1

    MENU oMn1 POPUP
        MENUITEM "Test 1" ACTION MSGINFO( "Test 1" )
        MENUITEM "Test 2" ACTION MSGINFO( "Test 2" )
        MENUITEM "Test 3" ACTION MSGINFO( "Test 3" )
    ENDMENU

    DEFINE RIBBONBAR oRib OF oDlg;
           PROMPT "Test 1", "Test 2", "Test 3"

    oRib:SetSize( oDlg:nWidth, 100 )

    ADD GROUP oGr1 RIBBONBAR oRib;
              WIDTH 80;
              TO OPTION 1;

    @ 4, 4 ADD BUTTON GROUP oGr1;
           SIZE oGr1:nWidth - 9, oGr1:nHeight - 7;
           PROMPT "Test 1";
           BITMAP "OPEN.BMP";
           ACTION MSGINFO( "Test 1" )

    ADD GROUP oGr2 RIBBONBAR oRib;
              WIDTH 80;
              TO OPTION 1;

    @ 4, 4 ADD BUTTON GROUP oGr2;
           SIZE oGr2:nWidth - 9, oGr2:nHeight - 7;
           PROMPT "Test 2";
           BITMAP "OPEN.BMP";
           ACTION MSGINFO( "Test 2" );
           POPUP MENU oMn1

    ADD GROUP oGr3 RIBBONBAR oRib;
              WIDTH 80;
              TO OPTION 2;

    @ 4, 4 ADD BUTTON GROUP oGr3;
           SIZE oGr3:nWidth - 9, oGr3:nHeight - 7;
           PROMPT "Test 3";
           BITMAP "OPEN.BMP";
           ACTION MSGINFO( "Test 3" )

    ADD GROUP oGr4 RIBBONBAR oRib;
              WIDTH 80;
              TO OPTION 2;

    @ 4, 4 ADD BUTTON GROUP oGr4;
           SIZE oGr4:nWidth - 9, oGr4:nHeight - 7;
           PROMPT "Test 4";
           BITMAP "OPEN.BMP";
           ACTION MSGINFO( "Test 4" );
           POPUP MENU oMn1

    RETURN NIL


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: RibbonBar

Postby Enrico Maria Giordano » Fri May 31, 2013 11:10 am

First problem solved:

Code: Select all  Expand view
   DEFINE RIBBONBAR oRib OF oDlg;
           HEIGHT 100;
           PROMPT "Test 1", "Test 2", "Test 3"

    oRib:SetSize( oDlg:nWidth )


:-)

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: RibbonBar

Postby Enrico Maria Giordano » Fri May 31, 2013 11:14 am

Second problem: open the button menu and select an option, you will get a message. Then try doing the same once more. The menu will not popup. Retry and the menu will popup again. It shows only on the click number 1, 3, 5, and so on. Why?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: RibbonBar

Postby Enrico Maria Giordano » Fri May 31, 2013 11:22 am

Third problem: in the following sample, try to click on the fourth menu popup item (Test 4, the one withou action clause). The button will remain selected (ie. a lighter color).

Code: Select all  Expand view
#include "Fivewin.ch"
#include "Ribbon.ch"


FUNCTION MAIN()

    LOCAL oDlg

    DEFINE DIALOG oDlg;
           SIZE 800, 600

    ACTIVATE DIALOG oDlg;
             ON INIT MAKERIBBON( oDlg );
             CENTER

    RETURN NIL


STATIC FUNCTION MAKERIBBON( oDlg )

    LOCAL oRib

    LOCAL oGr1, oGr2, oGr3, oGr4

    LOCAL oMn1

    MENU oMn1 POPUP
        MENUITEM "Test 1" ACTION MSGINFO( "Test 1" )
        MENUITEM "Test 2" ACTION MSGINFO( "Test 2" )
        MENUITEM "Test 3" ACTION MSGINFO( "Test 3" )
        MENUITEM "Test 4"
    ENDMENU

    DEFINE RIBBONBAR oRib OF oDlg;
           HEIGHT 100;
           PROMPT "Test 1", "Test 2", "Test 3"

    oRib:SetSize( oDlg:nWidth )

    ADD GROUP oGr1 RIBBONBAR oRib;
              WIDTH 80;
              TO OPTION 1;

    @ 4, 4 ADD BUTTON GROUP oGr1;
           SIZE oGr1:nWidth - 9, oGr1:nHeight - 7;
           PROMPT "Test 1";
           BITMAP "OPEN.BMP";
           ACTION MSGINFO( "Test 1" )

    ADD GROUP oGr2 RIBBONBAR oRib;
              WIDTH 80;
              TO OPTION 1;

    @ 4, 4 ADD BUTTON GROUP oGr2;
           SIZE oGr2:nWidth - 9, oGr2:nHeight - 7;
           PROMPT "Test 2";
           BITMAP "OPEN.BMP";
           ACTION MSGINFO( "Test 2" );
           POPUP MENU oMn1

    ADD GROUP oGr3 RIBBONBAR oRib;
              WIDTH 80;
              TO OPTION 2;

    @ 4, 4 ADD BUTTON GROUP oGr3;
           SIZE oGr3:nWidth - 9, oGr3:nHeight - 7;
           PROMPT "Test 3";
           BITMAP "OPEN.BMP";
           ACTION MSGINFO( "Test 3" )

    ADD GROUP oGr4 RIBBONBAR oRib;
              WIDTH 80;
              TO OPTION 2;

    @ 4, 4 ADD BUTTON GROUP oGr4;
           SIZE oGr4:nWidth - 9, oGr4:nHeight - 7;
           PROMPT "Test 4";
           BITMAP "OPEN.BMP";
           ACTION MSGINFO( "Test 4" );
           POPUP MENU oMn1

    RETURN NIL


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Re: RibbonBar

Postby ADutheil » Sat Jun 01, 2013 2:31 pm

I think problem 3 can be solved with

Code: Select all  Expand view
MENUITEM "Test 4" ACTION ACTION oDlg:aControls[ 1 ]:setFocus()
Regards,

André Dutheil
FWH 13.04 + HB 3.2 + MSVS 10
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: RibbonBar

Postby Enrico Maria Giordano » Sat Jun 01, 2013 4:01 pm

ADutheil wrote:I think problem 3 can be solved with

Code: Select all  Expand view
MENUITEM "Test 4" ACTION ACTION oDlg:aControls[ 1 ]:setFocus()


Thank you, but doing so I'd move the focus from the current control. :-(

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: RibbonBar

Postby James Bott » Sat Jun 01, 2013 4:47 pm

Enrico,

I have tested problem three, and I see the problem, however, I can't imagine any situation (other than testing) where you would have a menu choice without an ACTION clause. So is this a real problem?

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: RibbonBar

Postby Antonio Linares » Sat Jun 01, 2013 5:45 pm

Enrico,

It seems that problem 3 gets fixed with this line to include at line 836 in Class TRbtn:

Code: Select all  Expand view
                       if oWnd:oPopup == nil
                           oWnd:oPopup = ::oPopup
                           ::oPopup:Activate( ::nTop + ::nHeight(),;
                                              ::nLeft - If( ! oWnd:IsKindOf( "TRBGROUP" ), oWnd:nLeft, 0 ), oWnd, .F. )
                           oWnd:oPopup = nil  // new !!!                                          
                        endif  
regards, saludos

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

Re: RibbonBar

Postby Enrico Maria Giordano » Sat Jun 01, 2013 6:07 pm

James,

James Bott wrote:Enrico,

I have tested problem three, and I see the problem, however, I can't imagine any situation (other than testing) where you would have a menu choice without an ACTION clause. So is this a real problem?

James


What about something like

ACTION n := 4

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: RibbonBar

Postby Enrico Maria Giordano » Sat Jun 01, 2013 6:08 pm

Antonio,

Antonio Linares wrote:Enrico,

It seems that problem 3 gets fixed with this line to include at line 836 in Class TRbtn:

Code: Select all  Expand view
                       if oWnd:oPopup == nil
                           oWnd:oPopup = ::oPopup
                           ::oPopup:Activate( ::nTop + ::nHeight(),;
                                              ::nLeft - If( ! oWnd:IsKindOf( "TRBGROUP" ), oWnd:nLeft, 0 ), oWnd, .F. )
                           oWnd:oPopup = nil  // new !!!                                          
                        endif  


Yes, it fixes the problem 2 (not 3)! Many thanks!

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: RibbonBar

Postby James Bott » Sat Jun 01, 2013 6:14 pm

Antonio,

Gee, Enrico and I just had a discussion about not setting objects to nil, but instead calling the End() method. Shouldn't that be done here too? I note that there are functions like Destroy() and DelItems() in the End() method that if not called might cause a memory leak.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: RibbonBar

Postby James Bott » Sat Jun 01, 2013 6:20 pm

Enrico,

What about something like

ACTION n := 4


Point taken. Or, any ACTION that doesn't cause a screen change of focus I suppose.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: RibbonBar

Postby Enrico Maria Giordano » Sat Jun 01, 2013 6:29 pm

James,

James Bott wrote:Enrico,

What about something like

ACTION n := 4


Point taken. Or, any ACTION that doesn't cause a screen change of focus I suppose.

James


Yeah. :-)

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: RibbonBar

Postby Enrico Maria Giordano » Tue Jun 04, 2013 3:29 pm

Fourth problem: there is a flicker on all the controls of the dialog when a ribbonbar tab is clicked. If a sample is needed I can create one.

Any ideas on how to alleviate the flickering?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Next

Return to FiveWin for Harbour/xHarbour

Who is online

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

cron