Uwe,
in this test there is a solution but I think is not good because I must use Memvar
Static oItem[90], oBtns[20]
oItem for disable/enable menuitem
oBtns for disable/enable buttons
on function Perform we can insert also the possibilty to check if the user have the authorization to open that procedure
Code: Select all
#include "fivewin.ch"
#include "ribbon.ch"
Static oItem[90], oBtns[20] // Menu and buttons
MemVar oMOpc, oBBar
function main()
local oRBar
local oWnd
local oGr
DEFINE WINDOW oWnd TITLE "RibbonBar Test " + FWVERSION from 1,1 to 600,600 pixel //brush oBrush1
DEFINE RIBBONBAR oRBar WINDOW oWnd PROMPT "Configuración", "Ficheros", "Informes", "Ayudas" HEIGHT 133 TOPMARGIN 25
ADD GROUP oGr RIBBON oRBar TO OPTION 1 PROMPT "test disable" width 130
@ 2,5 ADD BUTTON oBtns[16] PROMPT "Planner" ;
BITMAP "TOOLBAR_PLANNER" ;
GROUP oGr ROUND SIZE 72,72;
ACTION Perform("MyProcedure()",oItem[ 2],oBtns[ 16])
ACTIVATE WINDOW oWnd MAXIMIZED
oRBar:End()
return nil
//----------------------------------------------------------------//
FUNCTION Perform(cModulo,oItem,oBtnB)
DEFAULT oItem:=NIL
DEFAULT oBtnB:=NIL
oMOpc:=oItem
oBBar:=oBtnB
IF !Empty(oItem)
oItem:Disable()
ENDIF
IF !Empty(oBtnB)
oBtnB:Disable()
ENDIF
CursorWait()
bX:={|| &cModulo}
Eval(bX)
Memory(-1)
Sysrefresh()
CursorArrow()
return nil
//------------------------------------------------------------------------------------------------//
Function MyProcedure()
LOCAL oItem:=oMOpc, oBtnB:=oBBar
Local oWChld
DEFINE WINDOW oWChld TITLE "my procedure "
ACTIVATE WINDOW oWChld ;
VALID (oWChld:=Nil,Close(oItem,oBtnB) ,.T.)
return nil
//-------------------------------------------------------------//
STAT FUNC Close(oItem,oBtnB)
oBtnb:Enable()
* oItem:Enable()
RETURN (.T.)
you could create two archives: one with the list of all the program's modules and another with the permissions of all users. So from the Perform function you could check first if the module is active and then if even the current user has permission to access that module.
There are two advantages
By doing so we are not forced to insert the modules into the source, that is to say the procedures even if we have not yet created them
When I create a new module and compile it into the application I go to insert a flag in the modules archive
and then the perform () function
could return a message with "the module is not available" if it does not find that flag so for not having the error "function not found" in compilation
and at the same time stop that user who does not have access to that module "the user does not have access to this module"
but between saying and doing there is always the sea ... it was just an idea !!!!
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC