Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8265429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:48:02+00:00 2026-06-08T04:48:02+00:00

I am working with SBCL for Linux on an AMD64 machine. Function ANIMTEST instantiates

  • 0

I am working with SBCL for Linux on an AMD64 machine.
Function ANIMTEST instantiates an LTK window with a CANVAS widget. Two items, BARRIER and FOLLOWER, live in the canvas. Both spin continuously, with BARRIER at the center of the canvas and FOLLOWER intended to follow the mouse, which is not working as intended. My first attempt (see comment) resulted in absolute screen coordinates of the mouse being interpreted as relative coordinates within the canvas with no account of the offset between the two. After searching through ltk.lisp and docs, I found SCREEN-MOUSE-X/Y (Second Attempt, see comment). I feel like I am using SCREEN-MOUSE-X & -Y according to the documentation, but why is it not working?
= Note =
The file that contains ANIMTEST and the packages that support it load and run with no errors.
Functions I have defined (UCTK-BEAM, etc.) are tested and run fine.

(defun animtest ()
      "Test a spinning figure in LTK"
      (with-ltk ()
        (let* ((cnvs (make-instance 'canvas :width 400 :height 400))
           (barrier (uctk-beam 200 200 40 20))
           (follower (uctk-beam 0 40 40 20))
           (slp-time 50) ; in ms
           (bar-theta 0)
           (fol-theta 0))
          (labels ((update ()
             (draw barrier nil)
             (draw follower nil)
             (incf bar-theta (/ pi 15))
             (incf fol-theta (/ pi 15))
             (geo:set-theta barrier bar-theta)
             (geo:set-theta follower fol-theta)
             (geo:set-center follower 
                     ;== FIRST ATTEMPT ==
                     (cons (screen-mouse-x cnvs)
                       (screen-mouse-y cnvs)))
                     ; == SECOND ATTEMPT ==
                     ;(cons (canvasx cnvs (screen-mouse-x cnvs))
                    ;   (canvasy cnvs (screen-mouse-y cnvs))))
             (after slp-time #'update)))
        (pack cnvs :fill :both :expand 1)
        (update)))))

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T04:48:04+00:00Added an answer on June 8, 2026 at 4:48 am

    To grab the mouse position in a canvas widget, I don’t call the
    screen-mouse functions, but rather bind the motion and button press
    events. The callback gets passed the event structure which contains
    the slots event-x and event-y which are canvas coordinates. Not only
    are you getting the right values directly this way, but also it is
    more efficient, as you don’t have to poll the mouse position – you get
    updates automatically when it changes. In your case you could either
    choose to update the barrier on mouse-move or alternatively, just
    store the mouse coordinates in a variable you read inside your update
    loop.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Working on a small game using an HTML5 canvas, and javascript. And it's working
Working with an undisclosed API, I found a function that can set the number
Working on calling a C function from my asm project. I'm trying to push
Working demo CLick $(document).ready(function(e) { $('span#pijlr, span#pijll').show(); $('#gallery').css('overflow','hidden'); $('span#pijlr').click(function(e) { if (!$('#gallcont').is(':animated')) { var
Working on an old Kohana 2 project and I want to link two models.
Working with box2d and cocos2d, I've calculated two vectors: one is the vector pointing
To get my .sbclrc file working on the two computers I use, I'd like
Working with some basic java apps on CentOS 5 linux and I have my
Working SQL The following code works as expected, returning two columns of data (a
Working with COM interop, I can call a managed function from within unmanaged code.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.