On Sun, Feb 9, 2014 at 1:48 PM, Charles Harrison Shubert
<[email protected]>wrote:

>  Hi Bob,
>
>  Your debugging email was very helpful, but I thought that I'd respond to
> this thread as there are two issues from below that I want to address:
>
>  1. XHTML
> 2. Info.messageCallback
>
>  I've got things working so that I can move forward, but my current fixes
> seem more like workarounds than solutions (see below).
>
>  Many thanks,
>
>  --Chuck
>
>  ===================
>  1. XHTML
>  ===================
>
>  from my code:
>
>                  Jmol.setXHTML(model.ids.id_jsmol);
>>>
>>
>  from your response:
>
>   there is no need for the XHTML business. Really that's there just
> because it was in Jmol 11, and actually it was almost never used. XHTML was
> just too too difficult all around. HTML5 is way better.
>
>
>
>  The HTML structure for my app looks like:
>
>  <div> app
> <div> menubar </div>
> <div>
> <div> tabs </div>
> <div* id=jmoldiv*> jmol </div>
> </div
> </dib>
>
>  With no setXHTML Jmol puts the image over the top of the app <div> (i.e.
> the menubar and the tabs are hidden).
> With setXHTML Jmol puts the image in the jmol <div> (i.e. the menubar and
> the tabs are visible).
>
>
You mean

$(document).ready(function(){
   $("#jmoldiv").html(Jmol.getAppletHtml("jmolApplet0", Info))
})

does not work?

If that's the case, then I think  you have something subtle wrong with your
div styles. I'd like to see the page, if I could.




>  I need whatever setXHTML is doing to put the Jmol image where I want it
> to go.  I'm not sure how to do that without calling setXHTML.
>
>

I'm guessing the problem is that you are trying to populate that div prior
to page completion, using Jmol.getApplet instead of Jmol.getAppletHtml.



>
>  ===================
> 2. Info.messageCallback
> ===================
>
>  The debugging technique of setting messageCallback to "alert" broke the
> ice for me.
>
>  Info.messageCallback = "alert";  // worked
>
>  My problem was that Jmol couldn't see my function name.
>
>  Info.messagerCallback = "myMessageCallback"; // didn't work
>
> There is a lot of namespace closure going on with my stuff and the stuff
that calls my stuff. I needed a function/variable that Jmol could see.

> So, I created a window variable.
>
>  window.myvariable = myMessageCallback;
>

Ah, yes. If that's the case, that that's significant, that would indeed be
the problem. Jmol is going to use:

var o = window[tokens[0]];

so if myMessageCallback is not the same as window.myMessageCallback, then
that will fail.
Interesting...


> Info.readyFunction = myReadyFunction;
>
>  but could not see:
>
>  Info.messageCallback = "myMessageCallback";
>
>
>  Jmol gets an address to myReadyFunction, but only the name of
> myMessageCallback.  So, Jmol can call readyFunction, but doesn't have
> enough information about where myMessageCallbac function is to find it and
> call it.
>
>

Yes, I see that looks inconsistent. Info.readyFunction is called by the
JavaScript on the page, thus the direct function reference. Jmol callbacks
are called from within the Java or JavaScript, so they have to be
transmitted as string names of functions.


>  It would be nice if Jmol treated Info.messageCallback the same way that
> it treats Info.readyFunction.  Maybe there is already a way to do that, and
> I just missed it.
>
>
I agree, but that's the way it is. Java itself cannot handle direct
JavaScript function objects as variables, I think.Those are being passed as
<param> tags to the <object>. So strings only.



>  There also must be a jQuery way to give Jmol the name of
> myMessageCallback, but I haven't yet asked Google the right question.
>

I think you could do this:

Info.msgCallback = myMessageCallback
Info.messageCallback = "Info.msgCallback"

Just make sure

window.Info == Info

because Jmol is going to get that function as:

window["Info"]["msgCallback"]

Bob
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to