Page 1 of 1

Ribbonbar - oBar:enable()

PostPosted: Thu Nov 08, 2012 9:14 pm
by Otto
oBar:disable() - oBar:enable()

Hello Antonio,
it seems that oBar:enable() does not work.
Would you be so kind to have a look at this.

Thanks in advance
Otto



Code: Select all  Expand view
// TESTING ROUNDSIZE


#include "FiveWin.ch"
#include "ribbon.ch"

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

function Main()

   local oGrupo, oBtn1, oRibbon, oWnd
   local oBtn2, oBtn3, oBtn4, oBtn5

   SetBalloon( .T. )

   DEFINE WINDOW oWnd FROM 1, 1 To 22, 75 ;
      TITLE "This is a MDI enviroment"
   
   DEFINE RIBBONBAR oRibbon PROMPTS "Start","Edition","Tools","Themes","Help" OF oWnd ;
          HEIGHT 200 TOPMARGIN 25
   
   ADD GROUP oGrupo RIBBON oRibbon TO OPTION 1 PROMPT "Only a Group to Test"
   
   @ 05,04 ADD BUTTON oBtn1 PROMPT "Round 2" ;
           GROUP oGrupo SIZE 142, 25 Right BORDER ROUND ROUNDSIZE 2

   @ 35,04 ADD BUTTON oBtn1 PROMPT "Round 4" ;
           GROUP oGrupo SIZE 142, 25 Right BORDER ROUND ROUNDSIZE 4

   @ 65,04 ADD BUTTON oBtn1 PROMPT "Round 6" ;
           GROUP oGrupo SIZE 142, 25 Right BORDER ROUND ROUNDSIZE 6

   @ 95,04 ADD BUTTON oBtn1 PROMPT "Round 8" ;
           GROUP oGrupo SIZE 142, 25 Right BORDER ROUND ROUNDSIZE 8

   @ 125,04 ADD BUTTON oBtn1 PROMPT "Round 10" ;
           GROUP oGrupo SIZE 142, 25 Right BORDER ROUND ROUNDSIZE 10


   
    @ 300,30 ;
      BUTTON oBtn5 ;
      PROMPT "disable" ;
        SIZE 60, 20 ;
      ACTION oRibbon:disable() ;
          OF oWnd ;
       PIXEL

    @ 300,130 ;
      BUTTON oBtn5 ;
      PROMPT "enable" ;
        SIZE 60, 20 ;
      ACTION oRibbon:enable() ;
          OF oWnd ;
       PIXEL
   
   
   
   SET MESSAGE OF oWnd TO "A message bar"

      ACTIVATE WINDOW oWnd ;
         MAXIMIZED


return nil

Re: Ribbonbar - oBar:enable()

PostPosted: Thu Nov 08, 2012 10:10 pm
by Otto
Hello Antonio,
I don't know if this is the right ( Super:Enable( ) )
way to fix the problem but it is working.
Best regards,
Otto
Code: Select all  Expand view

METHOD Enable( nPos, lOnOff ) CLASS TRibbonBar
   local lOldStatus

   DEFAULT nPos := ::nOption

   if nPos > Len( ::aDialogs ) .or. nPos < 1
      return NIL
   endif

   if lOnOff != NIL
      lOldStatus := ::aEnable[ nPos ]
      ::aEnable[ nPos ] := lOnOff
      ::Default()
      ::Refresh()
   endif
    
    Super:Enable( )

return ::aEnable[ nPos ]
 

Re: Ribbonbar - oBar:enable()

PostPosted: Fri Nov 09, 2012 7:08 pm
by Francisco Horta
Otto,
you're right !!,
i tested obar:enable() and obar:disable() and not work..
i used this:
oRibbon:Hide(no.group) y oRibbon:Show(no.group)
before oRibbon:CalcPos()
regards
paco

Re: Ribbonbar - oBar:enable()

PostPosted: Fri Nov 09, 2012 7:54 pm
by Antonio Linares
Otto,

Implemented as suggested, many thanks! :-)