help with menu please - Ayuda con menu, por favor

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
Jose Marte2
Posts: 45
Joined: Thu Nov 16, 2017 2:19 pm
Location: República Dominicana

help with menu please - Ayuda con menu, por favor

#1 Post by Jose Marte2 »

Greetings, I hope you are well as well as your families.

Please if you could help me with this question.

I am starting to migrate a system that I have on clipper

I am using the menu called ownerdrw
The question is when selecting an option is there any way to disable that option or the menu that cannot be used until closing or returning from the selected option

thanks in advance

Español
Saludos, espero que esten bien al igual que sus familias.

Por favor si pudieran brindarme su ayuda con esta pregunta

Estoy comenzando a migrar un sistema que tengo en clipper

Estoy usando el menu que se llama ownerdrw

La pregunta es al momento de seleccionar una opcion hay alguna manera para desactivar esa opcion o el menu que no se pueda utilizar hasta cerrar o volver de la opcion selecciona

Las gracias anticipadas
José Marte
Software & Servicios


User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: help with menu please - Ayuda con menu, por favor

#2 Post by rdonnay »

Show us some of your code.

Do you use eXpress++ for the owner draw menu?
The eXpress train is coming - and it has more cars.

User avatar
Jose Marte2
Posts: 45
Joined: Thu Nov 16, 2017 2:19 pm
Location: República Dominicana

Re: help with menu please - Ayuda con menu, por favor

#3 Post by Jose Marte2 »

Thank you


// Creacion De Los Menus
STATIC FUNCTION CrearMenu( oDlgSisAdco )

PUBLIC hBarraMenu := {}
PUBLIC hBarSubMenu:= NIL
PUBLIC hBarra := NIL
PUBLIC hSubMenu := {}

hBarra:= oDlgSisAdco:menuBar()
hBarra:measureItem := {|nItem,aDims,self| MeasureMenubarItem(oDlgSisAdco,self,nItem,aDims) }
hBarra:drawItem := {|oPS,aInfo,self | DrawMenubarItem(oDlgSisAdco,self,oPS,aInfo) }

DC_SETKEYACTIVE(.T.)

DBUSEAREA(.T.,,"USUARIOS",,.T.,.F.)
IF NETERR()
MsgBox("NO SE PUEDE ABRIR BASE DE DATOS DE USUARIOS","*** AVISO ***")
BREAK
Else
DBSETINDEX("USUARIO1")
ENDIF

DBUSEAREA(.T.,,"OPCMENUG",,.T.,.F.)
IF NETERR()
MsgBox("NO SE PUEDE ABRIR BASE DE DATOS DE OPCIONES DEL MENU","*** AVISO ***")
BREAK
Else
DBSETINDEX("OpcMeng2")
ENDIF

DBUSEAREA(.T.,,"ACCESOGE",,.T.,.F.)
IF NETERR()
MsgBox("NO SE PUEDE ABRIR BASE DE DATOS DE ACCESO AL SISTEMA","*** AVISO ***")
BREAK
Else
DBSETINDEX("ACCESOG")
ENDIF

cCodiUsua = Codifica(cNombre)
DBSelectArea("OPCMENUG")
DBSeek("B")
Do While !Eof() .and. TipoMenu="B"
cCodiMenu := CodiMenu
If Estatus="A" .or. accesoge->(DBSeek(cCodiUsua+Str(cCodiMenu,5,0)))
If (Estatus="A" .or. accesoge->estatus != " ") .and. ChkAccOpc()
// Barra De Menu
AAdd(hBarraMenu, {CodiMenu, NuevoMenu() } )
EndiF
EndiF
DBSkip()
EndDo

For J := 1 To Len(hBarraMenu)
cBar := Left(str(hBarraMenu[J][1],5,0), 1)
DBSeek("P"+cBar)
Do While !Eof() .And. Str(CodiMenu,5,0) = cBar
cCodiMenu := CodiMenu
If !accesoge->(DBSeek(cCodiUsua+Str(cCodiMenu,5,0)))
AddAccOpc( cCodiUsua, CodiMenu, NivelMenu)
EndiF
If (Estatus="A" .or. accesoge->estatus != " ") .and. ChkAccOpc()
If TipoSub == "S"
cSub := Left(Str(CodiMenu,5,0), 3)
//Barra SubMenu
AAdd( hSubMenu, NuevoSubMenu(hBarraMenu) )
DBSkip(1)
Do While !Eof() .And. Str(CodiMenu,5,0) = cSub
cCodiMenu := CodiMenu
If !accesoge->(DBSeek(cCodiUsua+Str(cCodiMenu,5,0)))
AddAccOpc( cCodiUsua, CodiMenu, NivelMenu)
EndiF
If (Estatus="A" .or. accesoge->estatus != " ") .and. ChkAccOpc()
//Opciones De SubMenu
MenuProcedure(CodiMenu)
EndiF
DBSkip(1)
EndDo
Else
//Opciones Normales Del Menu
MenuProcedure(CodiMenu)
DBSkip(1)
Endif
Else
DBSkip(1)
Endif
Enddo
Next

//Salir Del Sistema
hBarMenu:= XbpImageMenu():new()
hBarMenu:BarText:= ""
hBarMenu:title := "~Salir"
hBarMenu:create( oDlgSisAdco )

hBarMenu:addItem( {"~Salir"+Chr(9)+"Alt+F4",;
{|| SalirMenu() },, XBPMENUBAR_MIA_OWNERDRAW },;
120 )

hBarra:addItem( {hBarMenu,,, XBPMENUBAR_MIA_OWNERDRAW} )


END SEQUENCE

DBSelectArea("OPCMENUG")
DBCloseArea()
DBSelectArea("ACCESOGE")
DBCloseArea()
DBSelectArea("USUARIOS")
DBCloseArea()

Return (hBarra != NIL)

// Salir Del Sistema
Static Function SalirMenu()
LOCAL nButton, nEvent, mp1, mp2
LOCAL oXbp := SetAppFocus()

nButton := ConfirmBox( , ;
"Desea Salir Del Sistema SISADCO?", ;
"SALIR DEL SISTEMA SISADCO", ;
XBPMB_YESNO , ;
XBPMB_QUESTION+XBPMB_APPMODAL+XBPMB_MOVEABLE )

IF nButton == XBPMB_RET_YES
DBCLOSEALL()
PostAppEvent(xbeP_Quit)
ELSE
DO WHILE NextAppEvent() <> xbe_None
nEvent := AppEvent(@mp1,@mp2,@oXbp)
oXbp:handleEvent(nEvent,mp1,mp2)
ENDDO
ENDIF
SetAppFocus(oXbp)
RETURN .F.

// Chequear Acceso Al Menu
STATIC FUNCTION ChkAccOpc()
RETURN .t.

// Anadir Opccion De Acceso Al Menu
STATIC FUNCTION AddAccOpc( cCodiUsua, cCodiMenu, nNivelMenu)
LOCAL nPrevArea
FIELD CodiUsua, CodiMenu, Estatus

nPrevArea := SELECT()

DBSelectArea("ACCESOGE")
While !RLock(); EndDo
DBAppend()
CodiUsua := cCodiUsua
CodiMenu := cCodiMenu
Estatus := IIF(nNivel >= nNivelMenu, "x", " ")
DBUnlock()
DBCommit()

DBSelectArea(nPrevArea)

Return .t.

// Opciones Para Ejecucion De Progrmas y Funciones
STATIC PROCEDURE MenuProcedure(pNumeroOpcion)
DO CASE
CASE pNumeroOpcion == 10107 // Egresos De Caja
hBarSubMenu:addItem( {AllTrim(OpcMenuG->DescrMenu),;
_ActiveBlock({|o| RECCAJA() },.T. ),,XBPMENUBAR_MIA_OWNERDRAW } )
CASE pNumeroOpcion == 10108 // Caja Chica
hBarSubMenu:addItem( {AllTrim(OpcMenuG->DescrMenu),;
_ActiveBlock({|o| CAJCHICA() },.T. ),,XBPMENUBAR_MIA_OWNERDRAW } )
CASE pNumeroOpcion == 10109 // Envios De Mercancias
hBarSubMenu:addItem( {AllTrim(OpcMenuG->DescrMenu),;
_ActiveBlock({|o| ENVIOS() },.T. ),,XBPMENUBAR_MIA_OWNERDRAW } )
ENDCASE
Return
José Marte
Software & Servicios


User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: help with menu please - Ayuda con menu, por favor

#4 Post by rdonnay »

Did you try hBarra:disable() ?
The eXpress train is coming - and it has more cars.

Post Reply