Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Window Position While Moving  (Read 1123 times)

0 Members and 1 Guest are viewing this topic.


  • Newbie
  • *
  • Posts: 1
    • View Profile
Window Position While Moving
« on: July 08, 2015, 06:35:31 pm »
Hey you all! This is my first post here, since I wasn't able to find an answer anywhere else.

The main thing I'm wondering right now is if it's possible to get the position of a Window while it's being moved/dragged by the user. I've looked a bit into Win32 API, but it seems like moving the window is a blocking action so that the position will only ever update after the drag is complete.

Is this the case? Is it a lost cause to try and interact with the window as it's being moved?



  • Guest
Re: Window Position While Moving
« Reply #1 on: July 08, 2015, 07:52:42 pm »
There is no sf::Event fired while the window is being moved, only once it has finished moving. A way to (possibly) get around this, is using a separate thread and using sf::Window::getPosition. Though, I am not sure how well this works, if at all.

The main question is: why would you need this?


  • Hero Member
  • *****
  • Posts: 3054
  • My number of posts is shown in hexadecimal.
    • View Profile
Re: Window Position While Moving
« Reply #2 on: July 08, 2015, 09:46:30 pm »
SFML processes Windows' messages and creates its own sf::Events for you to use. It doesn't give you access to the unused messages as they all get processed at once and it doesn't provide events on each movement of a window - just when it has finished moving.

However, you can create your window (still with SFML) without a title bar and draw your own, then move it manually.
I once created and posted the code for a draggable borderless window, which would, consequently, allow you access to the exact position at all times.
Selba Ward - SFML drawables
Kairos - Timing Library
Rectangular Boundary Collision - Rectangular SAT Collision

@Hapaxiation - Hapaxia on Twitter