It is really easy to start with jscripting in M3. Just open your jscript tool (Refer my previous blog for more details) Once you are done with that go to File -> New Script and create new script. It will generate the basic class structure for you. If you want to read a field in a M3 panel, you can use following code snippet.
var OType=ScriptUtil.FindChild(content, "QOMAUN");
You can use properties like, 1. Text – to view the field text. 2. IsEnabled (Boolean) – to enable/disable a field. If you want to give view (non-editable) access to a user for a filed, you can set “IsEnabled” property to “false”.
import System; import System.Windows; import System.Windows.Controls; import MForms; package MForms.JScript { class HelloWorld { var content; var controler; var debug; public function Init(element: Object, args: Object, controller : Object, debug : Object) { debug.WriteLine("Hello World!."); this.content = controller.RenderEngine.Content; this.controler = controller; this.debug = debug; var OType=ScriptUtil.FindChild(content, "QOMAUN"); debug.WriteLine("Hello Field - "+ OType.Text + ", let me dissable you"); //OType.IsEnabled = false; DisableField(OType); } public function DisableField(fieldObj){ fieldObj.IsEnabled = false; debug.WriteLine("Dissabled!! "); } } }

This comment has been removed by the author.
ReplyDelete