Page 1 of 1

Auto-open

Posted: Tue Oct 03, 2023 8:37 am
by omni
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

Re: Auto-open

Posted: Tue Oct 03, 2023 11:42 pm
by Tom
Hi, Fred.

You may store this or all menu actions in an array:

Code: Select all

aActions := { ... , { || MDIBlock( {||Pudisp()},'Load Status Screen' ) } } , ... }
Use this array when building the menu

Code: Select all

DCMENUITEM .... ACTION aActions[2]
If you want one of these actions to be called elsewhere, just Eval() the item:

Code: Select all

IF UserName = 'Test'
  Eval(aActions[2])
ENDIF

Re: Auto-open

Posted: Mon Oct 16, 2023 3:40 pm
by omni
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

Re: Auto-open

Posted: Thu Oct 26, 2023 8:27 am
by omni
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