Hello again everyone, I have already succeeded with all this except with one
little thing where I need your advice... when I select a residue, a label
appears on its C-alpha, and I want the same label to appear in the textbox.
I highlight selected residues and write the labels via a function called
colorLabel I execute like this from in php:
'<script>jmolCheckbox("colorLabel(\'NAT\',\''.$prefix.'\',\'manual\',\''.$select_nat.'\',\'ONE\')",
"DELcolorLabel(\'NAT\',\''.$select_nat.'\',\'ONE\')",
"native");</script></td>';
So I have tried the following to get the label inside the textbox with no
success:
When initializing the applet:
jmolSetCallback("MessageCallback","msgFn");
Javascript function:
function msgFn() {
var x = [];
for (var i=0;i<arguments.length;i++) {
x[i] = "" + arguments[i];
}
var i = x[2].indexOf("colorLabel");
if (i!=-1){
var label = jmolEvaluate('select 2:A.CA and 1.1; var at={selected};
at.label');
var t = '\n' + document.getElementById('msg').value;
document.getElementById('msg').value = label + t;
}
}
But I only get "ERROR" inside the text box... How should it be? Thanks
again!
Daniel
2011/9/20 Daniel Carbajo <[email protected]>
> Ah ok, so while I try it let me ask you just one more thing... I label the
> residues using a complex function called "colorLabel" inside a file called
> myJMOLfunctions.spt, that you can access at:
> http://bl210.caspur.it/MODEL-DB/TEST/Jmol-12new/myJMOLfunctions.spt
> I am thinking that the easiest way would be to make the same label appear
> in the textbox by adding something similar to the following (after line 122
> of the spt file):
> var textbox = "NAT - " + info + " %m_%c_%r " + desc + ":" + larcav
> var t = '\n' + document.getElementById('msg').value
> document.getElementById('msg').value = textbox + t
>
> Can I do that in a Jmol function? I guess not, right? If there is a way to
> do show it would be the easiest...
>
>
>
>
> 2011/9/20 Paul Pillot <[email protected]>
>
>> You probably don't need any messagecallback here. You can reflace your
>> Jmol checkbox by any html object (a link for example) and attach to it an
>> onclick event that would trigger your msgFn() function :
>>
>> <a href="#" onclick="msgFn()">Click me !</a>
>>
>> function msgFn() {
>> var x = jmolScriptWaitAsArray("show residue")[0][0][3]
>> document.getElementById('msg').value = x +"\n" +
>> document.getElementById('msg').value;
>> }
>>
>> Le 20 sept. 2011 à 13:47, Daniel Carbajo a écrit :
>>
>> Ops sorry I copied the wrong line, it is:
>> jmolSetCallback("MessageCallback","msgFn");
>> Which does not work either... So I want that the selected residue appears
>> when I click on a jmol checkbox. Please check my example page:
>> http://bl210.caspur.it/MODEL-DB/TEST/testpage3.php
>>
>> 2011/9/20 Paul Pillot <[email protected]>
>>
>>>
>>> Le 20 sept. 2011 à 12:26, Daniel Carbajo a écrit :
>>>
>>> > I am trying the following (which does not work):
>>> >
>>> > javascript function:
>>> > function msgFn() {
>>> > var x = jmolScriptWait('print script("show residue")');
>>> > var t = '\n' + document.getElementById('msg').value;
>>> > document.getElementById('msg').value = x + t;
>>> > }
>>> >
>>> >
>>> > as initializing the applet:
>>> > jmolSetCallback("MeasureCallback","distFn");
>>> >
>>> There is something weird here : you trigger the distFn() function when
>>> user make a measure. But you've defined au msgFn() function. So it can't be
>>> triggered by the measure Callback.
>>> You have to be clear about when you want to update the selected residues
>>> list. Is it when a user makes a measure ? is it when the user clicks on a
>>> link or a button ?
>>>
>>> You can also use your browser to debug your javascript to see if your
>>> functions work as expected. For example, you can open the javascript console
>>> and type in : msgFn()
>>> you'll see if the list of residues is correctly displayed.
>>>
>>> > I would also like to include the temperature factor of the residue's
>>> C-alpha... any clue?
>>> Just a clue... print {6}.temperature will provide you with the mean
>>> temperature factor for all residues numbered 6. There is a way to get the
>>> list for each residue but I haven't done that for a while and I can't
>>> remember what the proper syntax is.
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> All the data continuously generated in your IT infrastructure contains a
>>> definitive record of customers, application performance, security
>>> threats, fraudulent activity and more. Splunk takes this data and makes
>>> sense of it. Business sense. IT sense. Common sense.
>>> http://p.sf.net/sfu/splunk-d2dcopy1
>>> _______________________________________________
>>> Jmol-users mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/jmol-users
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> All the data continuously generated in your IT infrastructure contains a
>> definitive record of customers, application performance, security
>> threats, fraudulent activity and more. Splunk takes this data and makes
>> sense of it. Business sense. IT sense. Common sense.
>>
>> http://p.sf.net/sfu/splunk-d2dcopy1_______________________________________________
>> Jmol-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/jmol-users
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> All the data continuously generated in your IT infrastructure contains a
>> definitive record of customers, application performance, security
>> threats, fraudulent activity and more. Splunk takes this data and makes
>> sense of it. Business sense. IT sense. Common sense.
>> http://p.sf.net/sfu/splunk-d2dcopy1
>> _______________________________________________
>> Jmol-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/jmol-users
>>
>>
>
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users