Kattes Posted December 12, 2018 Share Posted December 12, 2018 Hi, I tried following without any success: procedure TuSeatingDesignerFrame.UniPanel2Click(Sender: TObject); var s : string; begin // s := ' document.getElementById("' + UniSpeedButtonUndo.JSName + '_id").disabled = true; '; s := '$(''#'+UniSpeedButtonUndo.JSId + ''').disabled=true'; MessageDlg('JS: '+s, mtInformation, [mbOk], nil); UniSession.AddJS(s); end; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 12, 2018 Share Posted December 12, 2018 Hi, 46 minutes ago, Kattes said: I tried following without any success Can you please specify, which edition and build of UniGUI are you using ? Quote Link to comment Share on other sites More sharing options...
Kattes Posted December 12, 2018 Author Share Posted December 12, 2018 It is one of the latest versions. It was bought about a month ago. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 12, 2018 Share Posted December 12, 2018 14 minutes ago, Kattes said: It is one of the latest versions. It was bought about a month ago. Please first of all adjust your forum email address: http://forums.unigui.com/index.php?/topic/6291-new-users-please-adjust-your-forum-email-address/ Quote Link to comment Share on other sites More sharing options...
Kattes Posted December 12, 2018 Author Share Posted December 12, 2018 Ok, done Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 13, 2018 Share Posted December 13, 2018 7 hours ago, Kattes said: Ok, done Thank you for the update Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 13, 2018 Share Posted December 13, 2018 9 hours ago, Kattes said: I tried following without any success: procedure TuSeatingDesignerFrame.UniPanel2Click(Sender: TObject); var s : string; begin // s := ' document.getElementById("' + UniSpeedButtonUndo.JSName + '_id").disabled = true; '; s := '$(''#'+UniSpeedButtonUndo.JSId + ''').disabled=true'; MessageDlg('JS: '+s, mtInformation, [mbOk], nil); UniSession.AddJS(s); end; Well, this code is not a client side code Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 13, 2018 Share Posted December 13, 2018 The code should be something like this, and you should put it in ClientEvents or in CustomJS: YourButtonJsName.setDisabled(true/false); Quote Link to comment Share on other sites More sharing options...
Kattes Posted December 13, 2018 Author Share Posted December 13, 2018 Thank you, this is working fine: procedure TuSeatingDesignerFrame.UniPanel2Click(Sender: TObject); var s : string; begin s := UniSpeedButtonUndo.JSName + '.setDisabled(true)'; UniSession.AddJS(s); end; ..but finally does not really help me to solve my current problem, which I want to explain you a bit more in detail. Picture below describes my current configuration. I am using a MainForm, which uses the great UniTreeMenu component. Each tree-item click will dynamically create a TUniFrame, which finally allows my to struct my project, because each TUniFrame uses its own Delphi unit. Current module I am working on is a seating manager, which is also running in his own frame. The graphically components I am using is FabricJS - a very cool JS graphic engine. All needed Fabric routines including my own JS interfaces are running in the UniHTMLFrame. As long as I simply want to control from the tool bar (e.g. deleting a selected object, by clicking the litter bin symbol) routines defined in the HTMLframe this is easy and possible. But now I want to control the buttons from the tool bar from the HTMLframe side. In my case I want to enable and disable the Undo and Redo buttons depending of the status of a JS variable I created in the HTMLframe. Is there any way to do that? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 13, 2018 Share Posted December 13, 2018 Firstly, Congratulations, I think you are making a great product! Secondly, Can you make a simple testcase for this (with UniSpeedButton and UniHTMLFrame with your logic (without FabricJS))? Quote Link to comment Share on other sites More sharing options...
Kattes Posted December 13, 2018 Author Share Posted December 13, 2018 Firstly, thank you for your compliment - I am just trying my best to satisfy my customer (who is my own son ;)) Secondly, attached you will find the requested testcase for my current problem BTW thank you very much for your support ! JS_Sample.zip Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 13, 2018 Share Posted December 13, 2018 Thank you, I will check your testcase Quote Link to comment Share on other sites More sharing options...
Kattes Posted December 13, 2018 Author Share Posted December 13, 2018 Ups, after playing a bit with my sample code, I was able to solve the problem by myself. For the sample code the solution is: MainForm.UniSpeedButtonRedo.setDisable(true); ..and for my special case using uniFrame it is: uSeatingDesignerFrame.UniSpeedButtonRedo.setDisable(true); with uSeatingDesignerFrame as Name of the used TUniFrame. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 13, 2018 Share Posted December 13, 2018 Yes, very good! 1 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.