good call, Angel -- yes, this is a Jmol-user issue, not a developer one, since it involves no Jmol code issues.
Michael, if you Google apple resize you will get a number of solutions for automatically resizing an applet -- Sounds like Angel has one. See for example http://blog.taragana.com/index.php/archive/resizing-applets-dynamically-within-browser-frames/ It uses something like this (MSIE only here). One trick might be that on load the applet may not be fully initiallized. My quick an dirty solution based on that JavaScript code is at http://www.stolaf.edu/academics/chemapps/jmol/docs/examples-11/resize.htm Note that I issue zoomLarge = false at the beginning of my script -- That's to ensure that as the applet resizes the molecule stays within the window. There's also a hack in there because Jmol.js doesn't support proportional size windows. [We should fix that, Angel. Perhaps just allowing: jmolApplet(["50%","50%"]) or jmolApplet("50%") -- I think it's one line of code.] There is no issue of "flood Jmol with refreshes". Jmol just ignores a resize if it is the same dimensions as it already has. And if it is currently in the process of refreshing, it ignores a refresh request. So that's not an issue. Especially in a case like this where you know for a fact the browser is MSIE because it is a component of your Visual Basic program. Again, window resizing is standard procedure with the application -- the Jmol end of things has been capable of this for a long time. This is just the first time anyone has thought about it in terms of the applet. Angel Herraez wrote: >[ This follows a post and discussion held partly in jmol-developers >and partly privately; I am posting it here since it may be of help to >other users ] > >Michael Marden wrote: > > > >>thanks for your comments on the applet size. >> >>In my case Visual Basic (VB) is providing the Web-window and Bob's >>script is providing communication - via the hard disk. I added an >>explicit VB button (command) to reset the applet to a new size, based on >>the current window size; this works, but of course resets the molecule. >>It was not reasonable to do it during resizing, since the round trip to >>the disk is too slow. >> >>I did try to paste in the suggestion by Angel H.: >><script type="text/javascript"> >>function resize(n) >>{ >>document.getElementById("jmolApplet0").width = n >>document.getElementById("jmolApplet0").height = n >>} >>function resizeCSS(n) >>{ >>document.getElementById("jmolApplet0").style.width = n+"px" >>document.getElementById("jmolApplet0").style.height = n+"px" >>} >></script> >> >>but I got errors. Maybe Bob can tell me what exact form I need within >>the current script he setup. >>Overall we need an applet size that follows a percentage of the >>Web-window (without having to pass external messages via the disk). >>hopefully I can now respond via the Jmol users group. >>thanks again, >> >> > > >Michael, if you just need an applet that is sized a percent of the >web page window, that can be done easily (I can send you my >JavaScript code that works). The tricky part is to have the applet >resize when the browser is resized. As pointed out by Miguel, this >probably involves too many resize events and can choke Jmol, or the >browser. >But a per-request resize should also be easy to have. > >Please, advise > > >------------------------------------------------------------------------- >Take Surveys. Earn Cash. Influence the Future of IT >Join SourceForge.net's Techsay panel and you'll get the chance to share your >opinions on IT & business topics through brief surveys-and earn cash >http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >_______________________________________________ >Jmol-users mailing list >[email protected] >https://lists.sourceforge.net/lists/listinfo/jmol-users > > ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Jmol-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jmol-users

