Mouse move - position track uanble get the child node on mou

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
krithigal
Not too shy to talk
Not too shy to talk
Posts: 40
Joined: Wed Jan 12, 2005 12:06

Mouse move - position track uanble get the child node on mou

Postby krithigal » Fri Feb 25, 2005 09:51

I am trapping mouse move event. My requirement is to select all nodes which are traversed on mouse drag. I am able to trap mouse move and is geteting appropriate position values. But if I try to get the child node at the mouse move position, this does not return a valid pointer.

Below is the code snippet.

/*************************************************************************
handle mouse move
*************************************************************************/
void DateButton::onMouseMove(MouseEventArgs& e)
{
static int num;

// ButtonBase::onMouseMove(e);
Window::onMouseMove(e);

Window* sheet = System::getSingleton().getGUISheet();

#ifdef DEBUG
this == sheet->getChildAtPosition(e.position);
// logIntValue("DateButton::onMouseMove from onMouseMove begin - date value if ", this->getDate());

#endif
// convert mouse position to something local

Point localMousePos(screenToWindow(e.position));

if (getMetricsMode() == Relative)
{
localMousePos = relativeToAbsolute(localMousePos);
}
#ifdef DEBUG
this == sheet->getChildAtPosition(e.position);
//logIntValue("DateButton::onMouseMove after localMousePos - date value if ", this->getDate());

#endif

if (d_dragMoving)
{
if (sheet != NULL)
{
if (this == sheet->getChildAtPosition(e.position))
{
// logIntValue("DateButton::onMouseMove befor MouseMoveOverDate() XXXXXXX- date value if ", this->getDate());

// MouseMoveOverDate();
}
}


// WindowEventArgs args(this);
// fireEvent(EventDateMouseMove, e);
}
else if (d_segmentPushed && !d_dragMoving)
{
//initDragMoving();
d_dragMoving = true;
logMsg("entering initDragMoving");
}

e.handled = true;


}

/*************************************************************************
handle mouse button down.
*************************************************************************/
void DateButton::onMouseButtonDown(MouseEventArgs& e)
{

#ifdef DEBUG
// logMsg("DateButton::onMouseButtonDown");
#endif

// base class processing
ButtonBase::onMouseButtonDown(e);

// select
if (e.button == LeftButton)
{
Window* sheet = System::getSingleton().getGUISheet();

if (sheet != NULL)
{
if (this == sheet->getChildAtPosition(e.position))
{
#ifdef DEBUG
logIntValue("DateButton::onMouseButtonDown bef onselected() , date is ", this->getDate());
#endif
d_syskeys = e.sysKeys;
// onSelected();
}
}
}

// drag start
if (e.button == LeftButton)
{
// ensure all inputs come to us for now
if (captureInput())
{
// get position of mouse as co-ordinates local to this window.
Point localPos(screenToWindow(e.position));

if (getMetricsMode() == Relative)
{
localPos = relativeToAbsolute(localPos);
}

// store drag point for possible sizing or moving operation.
d_dragPoint = localPos;
d_segmentPushed = true;
}
}

e.handled = true;

}


I am able to get proper nodes on for the start node and for the end node and not for inbetween nodes.
Pl. let me know how to get the child instance which are being traversed on drag.

Pl help me out and I am stuck up.


regards
krithiga

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Mouse move - position track uanble get the child node on

Postby CrazyEddie » Fri Feb 25, 2005 10:54

I have no idea what these 'nodes' are since they're specific to your app. All I can say is that there's nothing in that code which detects a child window (so if nodes are attached child windows this is likely to be the issue).

CE.

User avatar
krithigal
Not too shy to talk
Not too shy to talk
Posts: 40
Joined: Wed Jan 12, 2005 12:06

Re: Mouse move - position track uanble get the child node on

Postby krithigal » Fri Feb 25, 2005 11:28

The line

this == sheet->getChildAtPosition(e.position)) is retrieving the child window.


But this does not point to a valid child window

Regarding node they are date buittons in a month pane.

Pl help me out
regards
krithiga

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Mouse move - position track uanble get the child node on

Postby CrazyEddie » Sat Feb 26, 2005 09:48

the getChildAtPosition API is used extensively throughout the system and definately works in all circumstances.

Your code there is retrieving nothing, it's just seeing if the returned window is 'this' window.

CE.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 5 guests