Discussion: WindowMouseX() and WindowMouseY()

Everything else that doesn't fall into one of the other PB categories.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.

If I place a gadget on x10-y10 and go with the mouse to the upper left
corner of the gadget and get with WindowMouseX() and WindowMouseY()
different values than x10-y10 it's just not logical to me.

It seems that WindowMouseX() and WindowMouseY() refers to the whole
Window including Borders and Titlebar, not the Client/Inner Area which
can be populated by the coder.

So if people have different Themes (like XP or Classical etc.) there
will be different results.

What du you think :)

BTW: I placed this topic here instead in the BUG section, because
(I suppose) it's a point of view and not a real bug.

Have a nice day...

Franco
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by plouf.

this has been changed in a latest version so visible area start from 0,0 so when you draw in window or putting gadgets they will not displayed wrong when user has changed settings makeing them fatter or thinner and i think its correct this way, you can get system default window caption and frame with
Debug GetSystemMetrics_(#SM_CYCAPTION )
Debug GetSystemMetrics_(#SM_CYSIZEFRAME)

but i agree that these two should somehow intergrated in PB commands set for cases like these :))


Christos
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Berikco.

Mouse functions with caption and sizeborder calculated in would be better.
WindowAreaMouseX() and WindowAreaMouseY() maybe?
Or change existing functions?

Fred?


Regards,

Berikco

http://www.benny.zeb.be/purebasic.htm
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fred.

Ok, I will change that and break some existing programs :). That's a kind of sport !

Fred - AlphaSND
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Berikco.

Yes, its always fun to change your old code again

Regards,

Berikco

http://www.benny.zeb.be/purebasic.htm
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by freak.

Fred:

If I wanted to get the Position of the Mouse on the Screen, I did something like this: 'X = WindowX() + WindowMouseX()'

Since that isn't going to be possible after your changes, could you do something like
'ScreenMouseX()' and 'ScreenMouseY()' ?

I know, there is always an API Solution, and I have no problem with that, but
it would be more easy for beginners.

Timo
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by plouf.

Why change again ? couldn't be somethink like
WindowMousex([#Flag])
#WithWindowBorder ?

Christos
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.
Originally posted by plouf

Why change again ? couldn't be somethink like
WindowMousex([#Flag])
#WithWindowBorder ?

Christos
Christos idea would be the best solution.
Examples:

WindowMouseX() -> as it is now
WindowMouseY() -> as it is now
WindowMouseX(#PB_Window_InnerWidth) -> only the Inner Area
WindowMouseY(#PB_Window_InnerHeight) -> only the Inner Area

or something like that...

Have a nice day...

Franco
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by geoff.

The way I get client area mouse positions is to handle mouse
actions in a Callback:

Procedure Window_message_callback(hwnd,message,wparam,lparam)

Then extract the mouse X and Y positions from the callback long parameter.

mousex=lparam & $FFFF
mousey=lparam >> 16

But extra PureBasic functions ClientMouseX(), ClientMouseY() would be better.

My plea to Fred is please don't change existing commands unless they
are wrong. Having to check through all your existing code, modify it
and re-test it is a huge waste of time and is likely to introduce
bugs into previously good code. The stability and reliability of the
language is just as important as the richness of its features.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by freak.

Yes, geoff's Names make most Sense to me:

WindowMouseX() -> gets the Mouse Position relative to Window Placement (like now).
ClientMouseX() -> gets the Mouse Position relative to the Window's client area.

Like this, WindowMouseX() would not be wrong, as it does exactly what the mname says.
And no need to change existing Code.

Timo
dmoc
Enthusiast
Enthusiast
Posts: 739
Joined: Sat Apr 26, 2003 12:40 am

Post by dmoc »

Did anything change as a result of this thread/ Fred? (<<< Ha, Ha, I crack myself up sometimes :lol: )

I would like the choice of mouse coords wrt window or screen (esp screen at the mo), but I'd also like a platform independent PB command. ???
Post Reply