From: Julia Doh (juliagoestocollege_at_gmail.com)
Date: Wed Mar 30 2011 - 15:33:28 CDT

Hello! This looks like what we need but I'm having some trouble. I found an
earlier message in the mailing list where you provided to someone an example
of the VMD mouse callback that looked like this:

proc do_mouse_pos_client { args } {
    global vmd_mouse_pos
    puts "mouse position: $vmd_mouse_pos"
}
trace add variable vmd_mouse_pos write do_mouse_pos_client
mouse mode userpoint

I pasted the above into the Tk console and it does work, however then the
OpenGL display doesn't respond to my mouse. When I click on the OpenGL
display window and change the mouse mode I can manipulate the molecule again
but the script no longer tracks my mouse (no longer being executed). Is
there any way for the script to track my mouse movement and button clicks
while using the OpenGL Display simultaneously?

Also I tried writing a miniature callback script for vmd_mouse_pos using the
formatting of outlined by the manual and wrote this:

proc rotate {args} {
    upvar #0 $varname var
    puts $var
}

proc enabletrace {} {
    eval "trace add variable ::vmd_mouse_pos write rotate"
}

proc disabletrace {} {
    eval "trace remove variable ::vmd_mouse_pos write rotate"
}

However nothing happens when it is read by the Tk Console.
Do you know how I can fix these issues?

Thanks for reading, we appreciate your help
Julia Doh

On Thu, Mar 17, 2011 at 12:11 PM, John Stone <johns_at_ks.uiuc.edu> wrote:

> Hi,
> I think that if you check the button state of the mouse or
> changes to the mouse mode, you may be able to avoid processing
> your routine on every rotation, and instead only process when
> the user stops rotating (when they release the mouse button).
>
> The mouse position callback variable is:
> vmd_mouse_pos
>
> The list of values set therein is:
> x y buttons
>
> Let us know if you need any help or want a callback that
> behaves differently then the existing ones do.
>
> Cheers,
> John Stone
> vmd_at_ks.uiuc.edu
>
> On Wed, Mar 16, 2011 at 11:45:31AM -0700, Julia Doh wrote:
> > Hi,
> >
> > I recently wrote a script that calculates all the residues in a
> protein
> > within the maximum y value and the number of angstroms the user
> inputs. I
> > have been using the TCL callback vmd_logfile to have the program
> update
> > automatically whenever the molecule is rotated. However, the procedure
> is
> > executed with every single rotate statement that appears in the
> > vmd_logfile when the protein is rotated. This makes the whole thing
> run
> > far too slow to be useful and we are only interested in the top
> residues
> > of the new orientation, not all the orientations in between.
> >
> > I was using the callbacks in the VMD manual
> > (http://www.ks.uiuc.edu/Research/vmd/current/ug/node153.html) to look
> at
> > the available callbacks but I was wondering if there were any more?
> Are
> > there any that listen for mouse events, such as a mouse-release upon
> > rotating the protein? If not, suggestions on better callbacks we can
> use
> > would be appreciated.
> >
> > Thank you,
> > Julia
>
> --
> NIH Resource for Macromolecular Modeling and Bioinformatics
> Beckman Institute for Advanced Science and Technology
> University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
> Email: johns_at_ks.uiuc.edu Phone: 217-244-3349
> WWW: http://www.ks.uiuc.edu/~johns/ Fax: 217-244-6078
>