How To #4 – Open a text editor in read only mode #baanhowto
How to open a text editor in read only mode?
Lot many times, we forget minor things which may be of real importance in a customization , specially when you are at the client location. Lets consider a simple example of not allowing the user to edit text conditionally.
How will you achieve this ? Not really a big thing, you just need to inform the text manager to open the editor in read only mode, so that even if the user opens the editor he/she can’t edit the text.
The code snippet below will make the explanation more clear.
choice.text.manager: before.choice: if (attr.textfield$ = "tcxxx001.txta" ) then attr.textmode = 1 else attr.textmode = 3 endif
The if statement checks, if the Text Manager is using the text field assigned to the variable “attr.textfield$“. Now if the condition is true, a value “1” is assigned to the variable “attr.textmode“ & “3” otherwise.
The variable “attr.textmode” informs the text manager how to react on, when a user tries to open the text editor (whether it should be opened in Read Only mode or Read/Write mode). The value “1”, makes the mode Read Only & “3” makes it Read/Write.
Both the variables can only be used in 4GL scritping.