Haciendo pruebas en una ventana MDI usando un Menubar y una Toolbar / alternando con una Ribbonbar al ir y venir de un estilo a otro se quedan congelados los botones prodrian indicarmen qcual seria la forma correcta de hacer esta operacion, adjunto el codigo que estoy utilizadno para hacer esta prueba.
Code: Select all
#include "fivewin.ch"
#include "ribbon.ch"
*--
REQUEST HB_LANG_ES
REQUEST HB_LANG_ESWIN
REQUEST HB_CODEPAGE_ES850C
*--
#define COLOR_WINDOW 5
#define COLOR_WINDOWTEXT 8
*--
#define TRUE .T.
#define FALSE .F.
*--
PROCEDURE Main()
*--
LOCAL oApp
LOCAL bOldError
*--
oApp := TAplication():New()
*--
BEGIN SEQUENCE
bOldError = ErrorBlock( { | o | DoBreak( o ) } )
oApp:Activate()
END SEQUENCE
ErrorBlock( bOldError )
RETURN
*--
*
*--
CLASS TAplication
*--
DATA oWndMain
DATA oRibBonb
DATA oMenuBar
DATA oToolBar
*--
VAR oGroup1, oBoton1, oBoton2
VAR oGroup2, oBoton3
*--
VAR oQck, oQbtn1, oQbtn2, oQbtn3, oQbtn4
VAR nMenuwin AS NUMERIC INIT 2
*--
METHOD New() INLINE Self
METHOD Activate()
*--
METHOD MenuRibBon()
METHOD MenuClasic()
METHOD ButtomBar()
*--
METHOD CambiaMenu()
ENDCLASS
*--
*
*--
METHOD Activate() CLASS TAplication
*--
LOCAL oIcon
::oMenuBar := TMenu():New(NIL)
*--
DEFINE ICON oIcon FILE "\fwh\icons\fivetech.ico"
*--
DEFINE WINDOW ::oWndMain ;
COLOR GETSYSCOLOR( COLOR_WINDOWTEXT ), GETSYSCOLOR( COLOR_WINDOW );
TITLE "Alternando Menubar y Ribbon en MDI" ;
MENU ::oMenuBar ;
ICON oIcon ;
MDI PIXEL
*--
::MenuRibbon()
*--
DEFINE MESSAGE OF ::oWndMain PROMPT "PRESIONE LA TECLA (F8) PARA CAMBIAR EL MENU" ;
CENTER KEYBOARD DATE CLOCK 2007
*--
::oWndMain:bKeyDown := {|nKey| IIF( nKey == VK_F8, ::CambiaMenu(),) }
ACTIVATE WINDOW ::oWndMain MAXIMIZED VALID MsgYesNo( "Do you want to quit ?" )
RETURN( NIL )
*--
*
*--
METHOD MenuRibbon() CLASS TAplication
*--
LOCAL nWidth := ::oWndMain:nWidth
LOCAL aPrompts := { "Archivos","Ayuda"}
*--
::oRibBonb := TRibbonBar():New( ::oWndMain, aPrompts, {|| NIL }, 1, nWidth, 140, 55 )
::oRibBonb:nLeftMargin := 50
::oRibBonb:nGroupSeparation = 1
*--
::oGroup1 := ::oRibBonb:AddGroup( 200, "Grupo 1", 1 )
::oboton1 := ::oGroup1:AddButton( 10,10, 50, 80, "Programación", {|| MsgInfo( FWDESCRIPTION,FWVERSION ) },,,"\fwh\bitmaps\32x32\app.bmp" )
::oGroup1:AddSeparator(100)
::oboton2 := ::oGroup1:AddButton( 10,110, 50, 80, "Usuarios", {|| MsgInfo( FWDESCRIPTION,FWVERSION ) },,,"\fwh\bitmaps\32x32\users.bmp" )
*--
::oGroup2 := ::oRibBonb:AddGroup( 200, "Grupo 2", 2 )
::oboton3 := ::oGroup2:AddButton( 10,10, 50, 80, "Terminar", {|| ::oWndMain:End() },,,"\fwh\bitmaps\32x32\Exit.bmp" )
DEFINE QUICKBUTTON OF ::oRibBonb ;
BITMAP "\Fwh\bitmaps\16x16\fivetech.bmp",;
"\Fwh\Bitmaps\btnqcka.bmp",;
"\Fwh\Bitmaps\btnqckb.bmp",;
"\Fwh\Bitmaps\btnqckc.bmp" ;
ACTION MsgInfo( FWDESCRIPTION,FWVERSION )
*--
DEFINE QUICKACCESS ::oQck OF ::oRibBonb
ADD BUTTON ::oQbtn1 QUICKACCESS ::oQck BITMAP "\Fwh\bitmaps\16x16\floppy.bmp" ACTION MsgInfo("1")
ADD BUTTON ::oQbtn2 QUICKACCESS ::oQck BITMAP "\Fwh\bitmaps\16x16\closeall.bmp" ACTION MsgInfo("2")
ADD BUTTON ::oQbtn3 QUICKACCESS ::oQck BITMAP "\Fwh\bitmaps\16x16\additem.bmp" ACTION MsgInfo("3")
ADD BUTTON ::oQbtn3 QUICKACCESS ::oQck BITMAP "\Fwh\bitmaps\16x16\adddbf.bmp" ACTION MsgInfo("4")
RETURN( NIL )
*--
*
*--
METHOD MenuClasic() CLASS TAplication
*--
LOCAL oMenu
*--
MENU oMenu
MenuItem "&Archivos"
MENU
MenuItem "&Finalizar" ACTION ::oWndMain:End()
ENDMENU
MenuItem "Ay&uda"
ENDMENU
RETURN( oMenu )
*--
*
*--
METHOD ButtomBar() CLASS TAplication
*--
::oToolBar := TBar():New( ::oWndMain, 40, 40, .T. )
*--
DEFINE BUTTON OF ::oToolBar FILE "\fwh\bitmaps\32x32\exit.bmp";
GROUP ACTION ( ::oWndMain:End() ) NOBORDER TOOLTIP " Salir "
RETURN( NIL )
*--
*
*--
METHOD CambiaMenu() CLASS TAplication
*--
LOCAL nDialogo
LOCAL aOpciones := {" Clasico "," Ribbon "}
LOCAL nOption := MsgList( aOpciones, "Tipo de Menu",,,08,20," &Aceptar ",::nMenuwin, TRUE, " &Cancelar " )
*--
If nOption > 0
If nOption # ::nMenuwin
::oWndMain:Hide()
If nOption == 1
For nDialogo = 1 TO Len( ::oRibBonb:aDialogs )
AEval( ::oRibBonb:aDialogs[ nDialogo ]:aControls,{ |nCtrl| nCtrl:Super:End() } )
Next
*--
::oRibBonb:End(); ::oMenuBar := ::MenuClasic()
::oWndMain:SetMenu( ::oMenuBar, 7 ); ::ButtomBar()
AEval( ::oToolBar:aControls,{|oButton| oButton:Refresh () } )
Else
AEval( ::oToolBar:aControls,{|oButton| oButton:End() } )
::oMenuBar:End(); ::oMenuBar := TMenu():New( NIL )
::oToolBar:End(); ::oWndMain:oMenu := ::oMenuBar
::MenuRibbon()
EndIf
::oWndMain:Refresh(); ::nMenuwin := nOption; ::oWndMain:Show()
SysRefresh()
Endif
EndIf
RETURN( NIL )
*--
*
*--
STATIC PROCEDURE DoBreak( oError )
*--
LOCAL nArgs
LOCAL cInfo := oError:Operation
*--
If ValType( oError:Args ) == "A"
cInfo += " Args:" + CRLF
For nArgs = 1 TO Len( oError:Args )
MsgInfo( oError:Args[ nArgs ] )
cInfo += "[" + Str( nArgs, 4 ) + "] = " + ValType( oError:Args[ nArgs ] ) + ;
" " + cValToChar( oError:Args[ nArgs ] ) + CRLF
Next
EndIf
MsgStop( oError:Description + CRLF + cInfo,;
"Script error at line: " + AllTrim( Str( ProcLine( 2 ) ) ) )
BREAK
RETURN
*--
*
*--
INIT PROCEDURE StartUp()
*--
SET DATE BRITISH
SET CENTURY ON
SET DATE FORMAT TO "DD-MM-YYYY"
*--
set( _SET_CODEPAGE, "ESWIN" )
*--
HB_LangSelect("ES","ESWIN")
hb_cdpSelect( "ESWIN" )
HB_SetCodePage("ESWIN")
RETURN
*--
*