Auto-open

This forum is for eXpress++ general support.
Post Reply
Message
Author
omni
Posts: 547
Joined: Thu Jan 28, 2010 9:34 am

Auto-open

#1 Post 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

User avatar
Tom
Posts: 1205
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: Auto-open

#2 Post 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
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

omni
Posts: 547
Joined: Thu Jan 28, 2010 9:34 am

Re: Auto-open

#3 Post 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

omni
Posts: 547
Joined: Thu Jan 28, 2010 9:34 am

Re: Auto-open

#4 Post 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

Post Reply