How to disable OK button in MarvinEditorControl?

User 1a8d11549a

30-03-2012 06:10:49

I'd like to open the MarvinEditorControl dialog to display the reaction scheme of a read-only document, i.e. the OK-button of the dialog must be disabled to prevent changes to be transferred back. How do I disable the OK button from code? - Regards, Stefan

ChemAxon bd13b5bd77

30-03-2012 12:57:58

Hi Stefan,


as far as I remember your constructor of the derived class looked like this:


      public Form1() {
         InitializeComponent();
         base.CancelButton = new System.Windows.Forms.Button();
         if (base.AcceptButton != null){
             (base.AcceptButton as Button).Visible = false;
         }

 
         var lookAndFeels = UIManager.getInstalledLookAndFeels();
         UIManager.setLookAndFeel(lookAndFeels[0].getClassName());
         UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      }


I added a small hack please see it in red. Hmm, the best would be to expose these basic controls with a niceer interface or property, we will be consider this to come out with a better dialog object hierarchy.


Viktor


 


 

User 1a8d11549a

30-03-2012 13:26:32

Hi Victor,


Yes, your code works nicely, thanks! And obviously anything making .NET programming with this control a bit less hacky would be highly welcome.


Regards, Stefan