Hiding an MDI main menu from a NOWAIT dialog

Hiding an MDI main menu from a NOWAIT dialog

Postby Rick Lipkin » Wed May 20, 2009 8:01 pm

To All

I am trying to eliminate some of my WinChild dialogs and substituting the NOWAIT clause on the activate Dialog line .. however, in the MdiChild I could do a BuildMenu() and

Code: Select all  Expand view

//-----------------------
static FUNC BuildMenu()

LOCAL oMENU

MENU oMENU

   MENUITEM "                "

ENDMENU

RETURN( oMENU )
 


Which would in effect blank out the main MDI menu so the MDI controls would be hidden. I am trying to figure out how I can call a NOWAIT dialog from an MDI main menu and HIDE the MDI menu line ??

Thanks
Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Hiding an MDI main menu from a NOWAIT dialog

Postby ukoenig » Wed May 20, 2009 8:24 pm

Hello Rick,

You want to disable ( Hide ) the MDI-Menue of the Main-Window ? :

DEFINE WINDOW oWnd TITLE "Test" MDI MENU TMenu():New()

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: Hiding an MDI main menu from a NOWAIT dialog

Postby Rick Lipkin » Wed May 20, 2009 8:43 pm

Uwe

I have a main MDI window and from the MDI BuildMenu() which calls various other modules\programs .. The other programs called were MDIChilds and I could block out the MAIN MDI menu with the above code ( a grey line ) .. however, because MDI and MDI Children do NOT display Aero glass around the frame .. I want to change all those MDIChilds to Dialog\NoWait.

I need a way of Hiding the Main MDI oMenu from being executed and to HIDE or 'blank' out the MDI menus all together when a user navigates into the Dialog\Nowait module .. so none of the MDI events can run.. that is what I need to do.

Hope that makes sense ?

Thanks
Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Hiding an MDI main menu from a NOWAIT dialog

Postby patdriscoll » Wed May 20, 2009 10:36 pm

Rick,

I do a similar thing by using the WHEN clause. e.g:

MENUITEM m->oMenuB5 PROMPT "Joint Details" ACTION ( if(chkopt("A",2 ),rails(),) ) WHEN m->_Library

I make use of PUBLIC variables (crude, I know) and set this to .T. or .F. when required and issue a
m->oMenuB5:refresh()

I hope this works for you

Cheers,
Pat Driscoll
Australia
User avatar
patdriscoll
 
Posts: 16
Joined: Tue May 19, 2009 7:28 pm

Re: Hiding an MDI main menu from a NOWAIT dialog

Postby Rick Lipkin » Thu May 21, 2009 1:16 am

To All

Here is a small sample to demonstrate my problem .. _Utilmenu() is my attempt at a Dialog\Nowait .. notice that the main MDI Menu is still active ( which it should be ) .. however, the _Rptmenu() is an MDIChild and I use BuildMenu3() to blank out the MDI menu to imake it inactive.

What I would like to do is disable the MDI oMenu line in the start of _Utilmenu() and then I can restore it on the way out.

Here is the code .. as well as the two .rc's

Rick

Code: Select all  Expand view

// main.prg



#INCLUDE "FIVEWIN.CH"

STATIC  oWInd                 // main mdi window
STATIC  oBmap                 // mdi window .bmp
STATIC  lExitPgm := .F.
STATIC xMESSAGE

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

FUNC MAIN()

LOCAL cDEFA,nLEN,cFILE,cRIGHTS,SAYING,mSTART,aDIR,cRDD
LOCAL cREAD,cWRITE,cSUPER,cOLDDEFA,cADMIN
LOCAL nPOS,cLOGIN,dEXE
LOCAL nYEAR,nSCR1,nSCR2,aVER
LOCAL oICO, oRs, cSQL, oErr, cPROG
LOCAL lOK, oDLG, cINIFILE, cERR
LOCAL TEXT_EOF, BYTES_READ,cTEXT,nHANDLE
LOCAL oSAY, cSAY

PUBLIC xVOL := "C:", xREAD,xWRITE,xLOGIN,xSUPER,xADMIN
PUBLIC xPROVIDER, xSOURCE, xCATALOG, xUSERID, xPASSWORD, xPROGID
PUBLIC xTABLE, xHOLD_TABLE, xQUE_TABLE

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

PARAMETERS xTEXT

REQUEST DBFCDX
rddsetdefault ( "DBFCDX" )

xREAD   := " "
xWRITE  := " "
xLOGIN  := " "
xSUPER  := " "
xPROGID := " "
xADMIN  := " "

xPROVIDER := "SQLOLEDB"
*xSOURCE   := "MSSQL01"
xSOURCE   := "LWMWEBDB01"
xCATALOG  := "PCAS"
xUSERID   := "pcasuser"
xPASSWORD := "pcas"

nSCR1 := GetSysMetrics(0)
nSCR2 := GetSysMetrics(1)

//-- get timestamp on .exe //

cFILE := GetModuleFileName( GetInstance() )
aDIR  := DIRECTORY( cFILE )
dEXE  := aDIR[1] [3]

// where .exe started from is default directory //

mSTART := RAT( "\", cFILE )
cDEFA  := SUBSTR(cFILE,1,mSTART-1)

aDIR := NIL

SET DEFA to ( cDEFA )
cOLDDEFA := cDEFA

cRDD := xPROVIDER+"
on "+xSOURCE+" 32 bit -b x86"

SET DELETED on
SET CENTURY on
SET 3DLOOK on

nYEAR := ( year( DATE() )-5 )
SET EPOCH to ( nYEAR )

// test for TEXT mode /NL      for no logo

IF EMPTY( xTEXT )
   xTEXT := "
"
ENDIF

xTEXT := ALLTRIM( UPPER(xTEXT))


xLOGIN := WNetGetUser()      // FiveWin function
xLOGIN := UPPER( xLOGIN )
xLOGIN := xLOGIN+SPACE(8)
xLOGIN := SUBSTR(xLOGIN,1,8)


xWRITE := 'Y'
xSUPER := 'Y'
xADMIN := 'Y'

cRIGHTS := _Rights()

//----- main menu -------//

xMESSAGE :=  "
User  "+xLOGIN+"    Rights  "+cRIGHTS+        ;
      "
    Default= "+cDEFA+"      Rdd= "+cRDD+            ;
      "
    Revision  "+DTOC(dEXE)+;
      "
 -r"+str(nSCR1,4)+" x "+STR(nSCR2,4)

*DEFINE ICON oICO RESOURCE "
COUPLE"

DEFINE WINDOW oWind                                          ;
   FROM 0,2 to 28,78                                         ;
   TITLE "
PCAS Time and Data entry Program"                  ;
   MENU BuildMenu(cOLDDEFA,dEXE,cRDD,nSCR1,nSCR2,oWind)      ;
     MDI

  DEFINE BITMAP oBMAP FILENAME (cOLDDEFA+"
\PCAS.BMP") of oWind

SET MESSAGE OF oWind                                          ;
   to xMESSAGE CLOCK

   // key handler to trap key strokes  ESC to quit  //
   oWind:bKeyDown := {|nKey| IF(nKEY = 27, oWIND:END(), ) }

ACTIVATE WINDOW oWind                                         ;
   MAXIMIZED ;
   ON PAINT ( IF( xTEXT = "
/NL", ,PalBmpDraw( hDC, 0,0, oBMAP:hBitmap, oBMAP:hPalette, nSCR1, nSCR2 )));
   ON INIT ( IF( xTEXT = "
/NL", , MSGLOGO( cDEFA+"\SPLASH.BMP",2 )),               ;
             oWIND:Select(),  oWIND:Refresh() )               ;
   VALID ( IIF( !lExitPgm, ExitPgm( .T. ) , .F. ))

RETURN( NIL )

//---------------------------
Static Func _Rights()

LOCAL cREAD,cWRITE,cSUPER,cADMIN,cRIGHTS

STORE "
" to cWRITE,cSUPER,cADMIN

cREAD := "
R"

IF xWRITE = 'Y'
   cWRITE := "
W"
ENDIF
IF xSUPER = "
Y"
   cSUPER := "
S"
ENDIF
IF xADMIN = "
Y"
   cADMIN := "
A"
ENDIF

IF cWRITE = "
" .and. cSUPER = " " .and. cADMIN = " "
   cRIGHTS := "
(READ)"
ELSE
   cRIGHTS := "
("+cREAD+cWRITE+cSUPER+cADMIN+")"
ENDIF

RETURN( cRIGHTS )

//--------------------------//
Static FUNC BuildMenu( cOLDDEFA, dEXE, cRDD,nSCR1,nSCR2,oWnd )

LOCAL oMenu, cRIGHTS, cDEFA

cDEFA := SET(7)

MENU oMenu

      MENUITEM "
&Pcas Data Entry ..."                ;
            ACTION Msginfo( "
Menu 1")                ;
            MESSAGE "
PCAS Data Entry"

      MENUITEM "
&Reports ..."                        ;
            ACTION( _Rptmenu( oWnd ))                ;
           MESSAGE "
Report Menu"

      MENUITEM "
&Utilities..."                       ;
            ACTION(  _UTILmenu( oWnd ) )             ;
            MESSAGE "
Utilities Programs"

      MENUITEM "
&Coordinator.."                      ;
            ACTION Msginfo( "
Menu 4")                ;
            MESSAGE "
Coordinators Menu"

      MENUITEM "
&Login Diff User .."                 ;
             ACTION Msginfo( "
Menu 5")               ;
             MESSAGE "
Login as a different User"

      MENUITEM "
&Intranet PCAS Manual .."            ;
            ACTION Msginfo( "
Menu 6")                ;
            MESSAGE "
PCAS Help on the DHECNET"

      MENUITEM "
&Quit"                               ;
            ACTION oWiND:END()                       ;
            MESSAGE "
End this Program"

ENDMENU

RETURN( oMenu )

//-----------------------
Static FUNCTION ExitPgm( lCLEAN )

IF lCLEAN = .T.
   lExitPgm := .T.
   SET RESOURCES to
   SysReFresh()
ENDIF

RETURN( lExitPgm )


//----------------------------------
Static FUNC _utilmenu( oWnd )

LOCAL oWndChild, oDlg, oBtn1, oBTN2, oBTN3, oBTN4, oBTN5, oBTN6
LOCAL oBTN7, oBTN8, oICO, aGrad

*oWnd:oMenu:Hide()   //  trying to make the mdi menu hide

aGrad := { { 1.0, 16777215, nRGB(4,53,107) },{ 1.0, nRGB(4,53,107), 16777215 } }

/*

DEFINE WINDOW oWndChild MDICHILD         ;
       FROM 1,1 to 25,38                 ;
       MENU BuildMenu1()                 ;
       NOMINIMIZE                        ;
       NOZOOM                            ;
       OF oWnd                           ;
       TITLE "
Utility Menu"

   oWndChild:bGotFocus  := { || oDlg:SetFocus() }
 */

   DEFINE DIALOG oDlg RESOURCE "
UTILMENU" ; // OF oWndChild ;
          TITLE "
Utility Menu"            ;


   REDEFINE BUTTON oBtn1 ID 101 OF oDlg   ;
      ACTION ( Msginfo( "
Indexing not required for SQL" ))

   REDEFINE BUTTON oBtn2 ID 102 OF oDlg   ;
      ACTION ( MsgInfo( "
Menu 2" )) // , _UtilBrow( oWnd ) )

   REDEFINE BUTTON oBtn3 ID 103 OF oDlg   ;
      ACTION ( MsgInfo( "
Menu 3" )) //,_empbrow( oWnd ) )

   REDEFINE BUTTON oBtn4 ID 104 OF oDlg   ;
      ACTION ( MsgInfo( "
Menu 3" )) //, _grpbrow( oWnd ) )

   REDEFINE BUTTON oBtn5 ID 105 OF oDlg   ;
      ACTION ( MsgInfo( "
Menu 4" )) //,_FyppBrow( oWnd ) )

   REDEFINE BUTTON oBtn6 ID 106 OF oDlg  ;
      ACTION( MsgInfo( "
Menu 5" )) //,_Purge() )

   REDEFINE BUTTON oBtn7 ID 107 OF oDlg   ;
      ACTION( MsgInfo( "
Menu 6" )) //, _HoliBrow(oWnd) )

   REDEFINE BUTTON oBtn8 ID 108 OF oDlg  ;
      ACTION( oDlg:End(), dbCloseAll() )


   ACTIVATE DIALOG oDlg NOWAIT ;
       ON PAINT GradientFill( hDC, 0, 0, oDlg:nHeight, oDlg:nWidth, aGrad, .T. )
   *   VALID  ( oDlg:End(), .t. )

   /*
   ACTIVATE DIALOG oDlg NOWAIT ;  // It has to be NonModal --> NOWAIT clause
      ON INIT ( oDlg:Move( 0, 0 ) ) ;
      VALID  ( oWndChild:End(), .t. )
   */
/*
ACTIVATE WINDOW oWndChild ;
   ON INIT oWndChild:SetSize( oDlg:nWidth, oDlg:nHeight, .T. )
 */
RETURN(NIL)


//-----------------------
static FUNC BuildMenu1()

LOCAL oMENU

MENU oMENU

   MENUITEM "
               "

ENDMENU

RETURN( oMENU )

//----------------------------------
Static FUNC _rptmenu( oWnd )

LOCAL oWndChild, oDlg, oBtn1, oBTN2, oBTN3
LOCAL Oico

DEFINE WINDOW oWndChild MDICHILD         ;
       FROM 1,1 to 15, 46.8              ;
       MENU BuildMenu3()                 ;
       NOMINIMIZE                        ;
       NOZOOM                            ;
       OF oWnd                           ;
       TITLE "
Report Menu"

   oWndChild:bGotFocus  := { || oDlg:SetFocus() }

   DEFINE DIALOG oDlg RESOURCE "
RPTMENU" OF oWndChild ;
          COLOR RGB(192,192,192), RGB(45,121,147)

   REDEFINE BUTTON oBtn1 ID 101 OF oDlg   ;
      ACTION ( msginfo("
menu 1")  )

   REDEFINE BUTTON oBtn2 ID 102 OF oDlg   ;
      ACTION (  msginfo("
menu 2") )

   REDEFINE BUTTON oBtn3 ID 105 OF oDlg  ;
      ACTION( dbCloseAll(), oWndChild:End() ) ;
      DEFAULT

   ACTIVATE DIALOG oDlg NOWAIT ;  // It has to be NonModal --> NOWAIT clause
      ON INIT ( oDlg:Move( 0, 0 ) ) ;
      VALID  ( oWndChild:End(), .t. )

ACTIVATE WINDOW oWndChild ;
   ON INIT oWndChild:SetSize( oDlg:nWidth, oDlg:nHeight, .T. )

return nil

//-----------------------
static FUNC BuildMenu3()

LOCAL oMENU

MENU oMENU

   MENUITEM "
               "

ENDMENU

RETURN( oMENU )

//-- END


// end main.prg


here are the .rc

Code: Select all  Expand view

RPTMENU DIALOG 25, 8, 206, 131
STYLE WS_CHILD
FONT 10, "MS Sans Serif"
{
 PUSHBUTTON "&Quit", 105, 9, 52, 29, 18
 PUSHBUTTON "1 >>", 101, 9, 7, 29, 18
 LTEXT "Program and Activity Report", -1, 46, 10, 138, 12, WS_BORDER | WS_GROUP
 PUSHBUTTON "2 >>", 102, 9, 29, 29, 18
 LTEXT "Employee Group Loc\\Prog\\Act\\Report", -1, 46, 32, 138, 12, WS_BORDER | WS_GROUP
 LTEXT "Return to Main Menu", -1, 46, 55, 138, 12, WS_BORDER | WS_GROUP
}
 


Code: Select all  Expand view


UTILMENU DIALOG 26, 9, 155, 208
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
FONT 10, "MS Sans Serif"
{
 PUSHBUTTON "&Quit", 108, 7, 159, 29, 18
 PUSHBUTTON "1 >>", 101, 7, 11, 29, 18
 LTEXT "Reindex Files", -1, 45, 14, 92, 11, WS_BORDER | WS_GROUP
 PUSHBUTTON "2 >>", 102, 7, 32, 29, 18
 LTEXT "Enter, Edit System Params", -1, 45, 35, 92, 11, WS_BORDER | WS_GROUP
 PUSHBUTTON "3 >>", 103, 7, 53, 29, 18
 LTEXT "Employee Information", -1, 45, 56, 92, 11, WS_BORDER | WS_GROUP
 PUSHBUTTON "4 >>", 104, 7, 74, 29, 18
 LTEXT "WorkGroup Information", -1, 45, 77, 92, 11, WS_BORDER | WS_GROUP
 PUSHBUTTON "5 >>", 105, 7, 95, 29, 18
 LTEXT "FYPP Hourly Table ", -1, 45, 98, 92, 11, WS_BORDER | WS_GROUP
 PUSHBUTTON "6 >>", 106, 7, 116, 29, 18
 LTEXT "PCAS Data Purge Routine", -1, 45, 119, 92, 11, WS_BORDER | WS_GROUP
 LTEXT "Return to Main Menu", -1, 45, 162, 92, 11, WS_BORDER | WS_GROUP
 PUSHBUTTON "7 >>", 107, 7, 137, 29, 18
 LTEXT "Holiday Schedule", -1, 45, 140, 92, 11, WS_BORDER | WS_GROUP
}
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Hiding an MDI main menu from a NOWAIT dialog

Postby FranciscoA » Thu May 21, 2009 5:07 am

[What I would like to do is disable the MDI oMenu line in the start of _Utilmenu() and then I can restore it on the way out ]

Rick: Maybe this partial code can help you.
Regards

//------------------------------
Function BuildMenu()
local oMenu, oItem1,oItem2
MENU oMenu 2007
MENUITEM oItem1 PROMPT "&Fichero"
MENU
MENUITEM "Emitir Recibo de &Caja" ACTION ( RCAJA(.T.) ) MESSAGE "Emision de documento"
MENUITEM "Con&sultar Recibo de Caja" ACTION ( if(BuscRC(),Rcaja(.f., .t.),) ) MESSAGE "Consulta de documento"
MENUITEM "Edicion Recibos de &Caja" ACTION ( oItem1:Disable(),oItem2:Disable(),oMenu:Refresh(),RECIBOSC(oItem1,oItem2,oMenu) ) MESSAGE "Edicion de documento"
SEPARATOR
MENUITEM "&Salir..." ACTION oWnd:End() MESSAGE "Finalizar esta sesion"
ENDMENU

MENUITEM oItem2 PROMPT "&Utilitarios"
MENU
MENUITEM "&Back-Up" ACTION if( MSGNET(), copiar(),) MESSAGE "Efectuar respaldo de ficheros del sistema"
MENUITEM "Recrear &Indices" ACTION If( MSGNET(), Ordenar(),)
SEPARATOR
MENUITEM "Calc&uladora..." ACTION WinExec( "Calc" ) MESSAGE "Activa calculadora de Windows"
MENUITEM "&Write..." ACTION WinExec( "Write" ) MESSAGE "Activa Write de Windows"
ENDMENU

MENUITEM "&Acerca de..." ACTION Licencia() MESSAGE "Alguna informacion sobre el programa"
MENUITEM "&Salir..." ACTION oWnd:End() MESSAGE "Finalizar esta sesion"
ENDMENU
return oMenu


//-----------------------
Function RECIBOSC(oItem1,oItem2,oMenu)
local oWndCh, oLbx, oBar

DEFINE WINDOW oWndCh MDICHILD OF oWnd TITLE "Emision de Recibos de Caja"+" ("+alias()+")"
...
...

ACTIVATE WINDOW oWndCh ;// MAXIMIZED
VALID ( oItem1:Enable(),oItem2:Enable(),oMenu:Refresh(),.t. )
RETURN NIL
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2158
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.


Return to FiveWin for Harbour/xHarbour

Who is online

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