Page 1 of 1
Moveable Window or Dialog
Posted: Tue Jul 08, 2003 12:52 pm
by TeddyLM
Hello there
I'm actually working on some application and i'd like my main window to be moveable on the screen but not outside the borders. Do somebody know how i can do this ?
Thanks in advance !
May the force be with you

Posted: Tue Jul 08, 2003 4:43 pm
by Searhin
a simple way would be to check in the beginning of the event loop (before actually processing events)
IF WindowX < 0 OR WindowX > ScreenWidth - WindowWidth
(and likewise for the Y coordinate)
if this is true you can relocate the window so that it is positioned exactly on the border of your Screen
i admit that's not a very sophisticated method

but it works fine nonetheless.
Posted: Tue Jul 08, 2003 5:32 pm
by Kale
A trick/tip about this:
viewtopic.php?t=5576
This tip though only works if 'show window when dragging' is enabled! i found out what was wrong though

, i was checking #WM_MOVE (catches event after move) instead of #WM_MOVING (catches event
while moving, which is missing from PB) this next link shows how to check for both.
A little app i coded that does this:
http://www.garyw.uklinux.net/PB/PureMonitor.zip
have fun

Posted: Tue Jul 22, 2003 11:13 am
by TeddyLM
Thanks Kale....
it works fine now !
(what would i do without you pals !!!

)