4D Write v16

WR LOCK COMMAND

Home

 
4D Write v16
WR LOCK COMMAND

WR LOCK COMMAND 


 

WR LOCK COMMAND ( area ; cmdNumber ; locked ) 
Parameter Type   Description
area  Longint in 4D Write area
cmdNumber  Longint in Number of the command to process
locked  Integer in 0=enables the execution 1=does not enable the execution

The WR LOCK COMMAND command allows you to prevent the user from being able to execute the command whose number is passed in cmdNumber. This can concern either a menu command or a palette command. This command affects the user's access to the indicated command only in the 4D Write area referenced by area. Access to the command is unaffected in other 4D Write areas.

In the locked parameter, you can pass one of the following constants, found in the "WR Parameters" theme:

Constant Type Value Comment
wr enabled command Longint 0 The command will be executed when it is called
wr locked command Longint 1 The command will not execute when it is called and will be disabled (grayed out) in the menus and palettes where it appears

Notes:

  • Even if a command is locked, your code can still execute it using the WR EXECUTE COMMAND command.
  • WR ON COMMAND will not be called if the user tries to select a command that is disabled.
  • When a menu or submenu is passed in cmdNumber, the menu and all its commands will be disabled (grayed out).

Although the commands of a disabled menu cannot be selected, keyboard equivalents or toolbar buttons can still be used. If you want to completely lock these commands, you must call WR LOCK COMMAND specifically for each menu item.

Note: The list of menus, commands and their reference is available in in the “WR Commands” constants theme. You can either pass a constant name or its values.

You want the designer to be the only user that can access the Design environment:

If the user name is not "Guru", the user will not be allowed to create new documents:

 If(Form event=On Load)
    If(Current user#"Guru")
       WR LOCK COMMAND(Area;wr cmd new;wr locked command)
    End if
 End if



See also 

Appendix B: Menu Item Numbers
WR ON COMMAND

 
PROPERTIES 

Product: 4D Write
Theme: WR Area Control
Number: 89446

 
HISTORY 

Created: 4D Write 6.5

 
ARTICLE USAGE

4D Write Language ( 4D Write v16)