EDITPROTECT & right-click menu

This forum is for eXpress++ general support.
Post Reply
Message
Author
DaSe
Posts: 3
Joined: Fri Jan 29, 2010 12:53 am
Location: Maldegem, Belgium
Contact:

EDITPROTECT & right-click menu

#1 Post by DaSe »

In our applications we have the following situation:

If a user has no permissions to modify data the data of on 'Address', then we block all the controles on the form with the In our applications we have the following situation:

If a user has no permissions to modify data the data of on 'Address', then we block all the controles on the form with the "EDITPROTECT"-option in DCGETOPTIONS (=> EDITPROTECT {|| !lEdit} ).
For the visibility, we put "Read only" in the title of the form.

This solution has a side effect.
The user still wants to copy data of some controls (e.g. street, city, phone, e-mail, ...) and paste it in other applications.
But because we use the EDITPROTECT-option, the right-click menu (with Cut, Copy, Paste, Delete, Select All) is not available anymore.

- Is there a possibility to enable a right-click menu ?
- Or are there other ways to achieve this functionality (block controls and enable a right-click menu) ?

Danny

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

Re: EDITPROTECT & right-click menu

#2 Post by Tom »

Hi, Danny.

Use this:

Code: Select all

@ n,n DCSAY .... KEYBLOCK {|a,b,o|IF(!lEdit,o:Undo(),nil)}
instead of EDITPROTECT. This will remove every keyboard entry, but still will allow to mark text and to access the context menu. But there is a side effect: The get field will still be able to get focus. This may irritate your users.
Best regards,
Tom

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

DaSe
Posts: 3
Joined: Fri Jan 29, 2010 12:53 am
Location: Maldegem, Belgium
Contact:

Re: EDITPROTECT & right-click menu

#3 Post by DaSe »

Hello Tom,

This seems to be a solution for my problem.
Thanks !

Danny

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

Re: EDITPROTECT & right-click menu

#4 Post by Tom »

Hallo, Danny.

Great. :)

But I just noticed that this will allow your users to cut the field contens aswell, so to clear the field/delete the contens. It will also allow to paste data into the field. A solution for this would be a custom replacement for the context menu, which I do for DCMULTLINES in order to provide more functionalities like access to a textblock database.

This should do this job (you can do this more elegant by using the SAYSUBCLASS for the get portion):

Code: Select all

@ n,n DCSAY ... KEYBLOCK ... GETEVAL {|o|o:RbDown := {|x,y,z|oGetMenu:PopUp(z,x,2,;
      XBPMENU_PU_DEFAULT + XBPMENU_PU_MOUSE_RBDOWN ) }}

    DCSUBMENU oGetMenu 
    DCMENUITEM "Copy" PARENT oGetMenu ACTION {|o|o:copyMarked()}
Best regards,
Tom

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

Post Reply