Is there a method to automatically open a specific menu option for a group of users when they login. The menu has probably over 200 options, but they want to force open one specific item for their own reasons. Menu still is displayed as normal
ACTION { || MDIBlock( {||Pudisp()},'Load Status Screen' ) } is the menu format, standard mdiblock.
Fred
Omni
Auto-open
Re: Auto-open
Hi, Fred.
You may store this or all menu actions in an array:
Use this array when building the menu
If you want one of these actions to be called elsewhere, just Eval() the item:
You may store this or all menu actions in an array:
Code: Select all
aActions := { ... , { || MDIBlock( {||Pudisp()},'Load Status Screen' ) } } , ... }
Code: Select all
DCMENUITEM .... ACTION aActions[2]
Code: Select all
IF UserName = 'Test'
Eval(aActions[2])
ENDIF
Best regards,
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Re: Auto-open
Worked this another way, but still a problem but only in ADS.
All menu options are mdiblock()
When they select any menu option (only the first time) it opens the one the mgt wants them to open.
Works fine on non-ads, gives an error on the ADS.
Menu looks like this
ACTION { || MDIBlock( {||Pudisp()},'Load Status Screen' ) }
****************************
STATIC PROCEDURE MDIBlock( bAction, ctitle )
LOCAL oThread, aChildList := oMainDialog:drawingArea:childList()
setappfocus(odlg)
//this is for first time regardless of selection
if lpudisp
bAction='pudisp'
ctitle='Load Status Screen'
lPudisp=.f.
endif
oThread := Thread():new()
if ladsomni
oThread:start( {|| AdsSession():setDefault(), Eval(bAction)} ) //error: ///Parameter has a wrong data type..
else
oThread:start( bAction ) //works fine non ads
endif
close all
RETURN
Tried the pudisp() and also failed, so gave up.
Fred
Omni
All menu options are mdiblock()
When they select any menu option (only the first time) it opens the one the mgt wants them to open.
Works fine on non-ads, gives an error on the ADS.
Menu looks like this
ACTION { || MDIBlock( {||Pudisp()},'Load Status Screen' ) }
****************************
STATIC PROCEDURE MDIBlock( bAction, ctitle )
LOCAL oThread, aChildList := oMainDialog:drawingArea:childList()
setappfocus(odlg)
//this is for first time regardless of selection
if lpudisp
bAction='pudisp'
ctitle='Load Status Screen'
lPudisp=.f.
endif
oThread := Thread():new()
if ladsomni
oThread:start( {|| AdsSession():setDefault(), Eval(bAction)} ) //error: ///Parameter has a wrong data type..
else
oThread:start( bAction ) //works fine non ads
endif
close all
RETURN
Tried the pudisp() and also failed, so gave up.
Fred
Omni
Re: Auto-open
On this, when mdiblock is sent the menu option, what is the actual item,
STATIC PROCEDURE MDIBlock( bAction, ctitle )
What exactly is bAction? When I try to see what it is, like with an alert, it says it is not a character string.
In this case, need to change it as if they selected pudisp() as the prg.
Odd that it works in non-ads, but not in ads where it does eval(bAction). Says invalid, but using a character string, which obviously it is not.
***never mind, had to remove the quotes and it worked
Fred
STATIC PROCEDURE MDIBlock( bAction, ctitle )
What exactly is bAction? When I try to see what it is, like with an alert, it says it is not a character string.
In this case, need to change it as if they selected pudisp() as the prg.
Odd that it works in non-ads, but not in ads where it does eval(bAction). Says invalid, but using a character string, which obviously it is not.
***never mind, had to remove the quotes and it worked
Fred