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
EDITPROTECT & right-click menu
Re: EDITPROTECT & right-click menu
Hi, Danny.
Use this:
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.
Use this:
Code: Select all
@ n,n DCSAY .... KEYBLOCK {|a,b,o|IF(!lEdit,o:Undo(),nil)}
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: EDITPROTECT & right-click menu
Hello Tom,
This seems to be a solution for my problem.
Thanks !
Danny
This seems to be a solution for my problem.
Thanks !
Danny
Re: EDITPROTECT & right-click menu
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):
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."
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."