Size of Marvin Sketch window at startup, Scroll Mouse

User 3d9ae0af2d

11-01-2010 23:36:52

Hi all,


 


is there any way to configure the size of the Marvin Sketch window at startup of the program? It's way too small here, so I always have to maximize it. And usually my (larger) structures are not centered in the window.


 


Talking about that, is there any chance to get Marvin Sketch to cooperate with a scroll mouse? Doesn't work here neither in MacOS nor in Windows.


 


Thanks!


 


Best wishes,


 


Thomas.

ChemAxon 7c2d26e5cf

12-01-2010 21:10:05

Currently, there is no option to modify default size of MarvinSketch application at startup.


I suggest to create a custom application (using MSketchPane component from the Marvin Beans API) where you can customize settings (also component size) as you like.

User 3d9ae0af2d

12-01-2010 22:29:59

thank you, Tamas. Unfortunately my programming skills are close to non-existing, so I guess I have to live with the current state.


 


Best wishes,


 


Thomas.

User 99339bfc89

27-05-2011 12:35:25

Tamas;


If I were to write a custom Marvin sketch program, then what parameter what I use to change the initial size of the sketch window?  I've tried many of the settings that I will would have thought would change the size of the MSketchPane but so far I've had no luck.  Is it something involving MViewParam, or should I be looking elsewhere?


 


Thanks,


Ben

ChemAxon 7c2d26e5cf

31-05-2011 12:34:35

It is out of the scope of the Marvin Beans API. MSketchPane behaves like any other Swing component.


The layout manager and the size of container where the component is embedded can also influence the size of the component.


Please consult with a Java Swing tutorial how to render components into a frame (or into other contains) and how to manage their sizes.


My personal opinion is that the simplest way is specifying the preferred size of the frame that includes the component. After that, the layout manager is responsible to fit components into the given space.

User 870ab5b546

31-05-2011 14:50:11

If you load the MarvinSketch applet via a Web page, you can use Javascript on the Web page to set the size of the Marvin window:


<script type="text/javascript">
// <!--
var panelWidth = 450;
var panelHeight = 350;
msketch_name = 'marvinApplet';
msketch_begin('/nosession/marvin', panelWidth, panelHeight);
msketch_param('molbg', '#ffffff');
msketch_param('scale', '32'); // C-C bond length in pixels; also increases font size
msketch_param('mol', marvinMol);
msketch_mayscript = true;
msketch_end();
// -->
</script>

You can also launch the sketcher window, either via Javascript ("detach" parameter) or manually through the GUI.  The sketcher window is infinitely resizable.

ChemAxon 7c2d26e5cf

01-06-2011 09:52:16

Applet and beans are different technology.


If you choose applet, you need a web server. In this case, you access Marvin through the server. On client side (who uses the applet), additional setting or installation are not required. The customization happens on server side. Marvin Applets package has to be install to the web server. After that, you can write a short HTML page where you embed the applet code. The embedded code specifies which applet you would like to see and how.


You do not require a separate machine for the web server, it can be installed your desktop machine. In this case, the client and the server can be the same machine. Of course, if there is a web server in your environment where you can deploy Marvin Applets package and your html document, it is the best option. In this case you can save the setup of the web server.


Meanwhile writting custom application with MSketchPane requires a small Java and Swing knowledge until applet integration requires a basic web development knowledge.


You can find code example both in Marvin Applets and in Marvin Beans packages. They can help to be familiar with the integration/customization of Marvin.

User 99339bfc89

03-06-2011 16:49:38

Tamas;


Do you have any example code that shows an MSketchPane resizing?  I have my MSketchPane sitting inside a component where I'm trying to use a migLayout, but I'm finding that the MSkethPane stays the same size while everything else shinks in the expected way.  I'm not sure what I'm missing, but if I could see an example then I'm confident that I could bend it to my purposes.  Thanks.

User 99339bfc89

03-06-2011 21:19:47

To be a little clearer about my previous post, here is the code that I'm now using to contain theMSketchPane:


frame(title:'Frame', size:[300,300], show: true) {
     migLayout(layoutConstraints:'debug, fillx')
     panel(id:'panel1'){
          migLayout(layoutConstraints:'debug, fill')
          textField("",constraints:'growx, growy 0, wrap')
          label("Core structure", constraints:'wrap',font:new Font("Serif", Font.BOLD,22))
         mSketchPane(id:'molSketch1', constraints:'push 100,grow')
      }
   }


( Note that this example is described in Griffon, not vanilla Java, so it may look a little funny, but it all compiles down to good old Java byte code in the end either way )


 


In this example the mSketchPane will expand when the JFrame expands, but it will not shrink beyond a certain minimum ( around 500 pixels, though I don't know exactly ).  What I'm wondering is this -- how can I get the mSketchPane to shrink to an arbitrary degree. 

ChemAxon 7c2d26e5cf

09-06-2011 15:00:34

I am not familiar in Griffon.


If you use Swing, you have to play with the preferred size of the sketcher to control its size: MSketchPane.setPreferredSize(java.awt.Dimension).


MSketchPane sketchpane;
...
sketchpane.setPreferredSize(new Dimension(500,500));