Mohammed Nasman Posted November 2, 2017 Share Posted November 2, 2017 Hello, I have this event on ExtEvents function click(sender, e, eOpts){ MyForm.window.showMask(); ajaxRequest(MyForm.window, 'newemail',[]);} due to creating multiple forms on runtime, the MyForm got multiple names such as Myform, MyForm_1, which lead to error on JS on running the application. On delphi code I can give self.name + '.window.hidemask(), but how can I call self.name from javascript code? Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted November 2, 2017 Administrators Share Posted November 2, 2017 "uname" should return it. Quote Link to comment Share on other sites More sharing options...
Mohammed Nasman Posted November 2, 2017 Author Share Posted November 2, 2017 Hi Farshad, it doesn't recognize uname as attached image. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 2, 2017 Share Posted November 2, 2017 Hi Mohammed, function click(sender, e, eOpts) - attached to which component? Quote Link to comment Share on other sites More sharing options...
Mohammed Nasman Posted November 2, 2017 Author Share Posted November 2, 2017 TuniToolButton Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 2, 2017 Share Posted November 2, 2017 Maybe you need to use like this ?!: procedure TMainForm.UniFormReady(Sender: TObject); begin with UniToolButton1.JSInterface do JSAddListener('click', JSFunction('me', 'var frmWin=' + Self.Name + '.window; frmWin.showMask(); ajaxRequest(frmWin, "newemail", [])')); end; Quote Link to comment Share on other sites More sharing options...
Mohammed Nasman Posted November 2, 2017 Author Share Posted November 2, 2017 Thanks Delphi Developer, I thought about similar way, but I wanted to find a better an easier way, because i have many of the TuniToolButton, and this require a lot of work :-/,so I asked looking for more easier and straightforward way. Is there any property similar to Self.name from JS? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 2, 2017 Share Posted November 2, 2017 Ok, Try this: sender.owner.window function click(sender, e, eOpts) { ajaxRequest(sender.owner.window, 'newemail', []); } 1 Quote Link to comment Share on other sites More sharing options...
Mohammed Nasman Posted November 2, 2017 Author Share Posted November 2, 2017 Perfect, that's it, thank you Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted November 2, 2017 Administrators Share Posted November 2, 2017 window.uname Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted November 2, 2017 Administrators Share Posted November 2, 2017 Hello, I have this event on ExtEvents function click(sender, e, eOpts) { MyForm.window.showMask(); ajaxRequest(MyForm.window, 'newemail',[]); } due to creating multiple forms on runtime, the MyForm got multiple names such as Myform, MyForm_1, which lead to error on JS on running the application. On delphi code I can give self.name + '.window.hidemask() , but how can I call self.name from javascript code? There is no self here because you are not inside an object. function click(sender, e, eOpts) { uniVars._actFrm_.uwindow.showMask(); } uniVars._actFrm_ returns the focused form. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.