Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » changing Ctr pos, react on mouse evnt
changing Ctr pos, react on mouse evnt [message #3376] Mon, 22 May 2006 14:02 Go to next message
qwerty is currently offline  qwerty
Messages: 130
Registered: May 2006
Experienced Member
greetings

how to get position of some Ctrl on TopWindow, compare it with mouse pointer position a do some stuff...

Specificaly something like this:

inside TopWindow
virtual void LeftDown(Point pos, dword flags) {
    if(pos.x >= someCtrl.GetPos().x.GetA() && pos.x <= someCtrl.GetPos().x.GetA() &&
       pos.y >= someCtrl.GetPos().y.GetA() && pos.y <= someCtrl.GetPos().y.GetA()) {

                PromptOK("clicked inside");
    }
}


...it's wrong, but how?

[Updated on: Mon, 22 May 2006 14:03]

Report message to a moderator

Re: changing Ctr pos, react on mouse evnt [message #3381 is a reply to message #3376] Mon, 22 May 2006 17:37 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
qwerty wrote on Mon, 22 May 2006 08:02

greetings

how to get position of some Ctrl on TopWindow, compare it with mouse pointer position a do some stuff...

Specificaly something like this:

inside TopWindow
virtual void LeftDown(Point pos, dword flags) {
    if(pos.x >= someCtrl.GetPos().x.GetA() && pos.x <= someCtrl.GetPos().x.GetA() &&
       pos.y >= someCtrl.GetPos().y.GetA() && pos.y <= someCtrl.GetPos().y.GetA()) {

                PromptOK("clicked inside");
    }
}


...it's wrong, but how?




Actually, is these cases it is often best to "go absolute".

There is "GetScreenRect" or "GetScreenView" methods that return position is screen coordinates and also GetMousePos funtions, that returns absolute mouse position.

Mirek
Re: changing Ctr pos, react on mouse evnt [message #3383 is a reply to message #3381] Mon, 22 May 2006 20:13 Go to previous message
qwerty is currently offline  qwerty
Messages: 130
Registered: May 2006
Experienced Member
...oh yesss, thank you!!
Previous Topic: how to add runtime StaticText and hook mouse events for it
Next Topic: ak math funcs on Ctrls
Goto Forum:
  


Current Time: Wed May 08 12:53:07 CEST 2024

Total time taken to generate the page: 0.01761 seconds