Callback when widget is moved

Hi,

How can I be notified by a callback when a widget is moved ?

Pt_CB_RESIZE is only usefull if the widget is resized never called when
moved.

I tried a filter callback (or event handler) on Ph_EV_EXPOSE but no luck…


Thanks.

Jean-Hugues Royer <jhroyer@joher.com> wrote:

Hi,

How can I be notified by a callback when a widget is moved ?

Yep! Set your window notified resource so that the PH_WM_MOVE
bit is set. Attach a Pt_CB_WINDOW callback (which is called when
event about which you’ve asked to be notified occur), check
inside that the event is a Ph_WM_MOVE, and go from there.

This is all for PtWindow widgets, of course. If the window is
moved, it’s various descendents in the widget family tree are
moved too.

If you need to respond to an individual widget being moved in
your display – that’s possible when you’ve set up to allow
dragging in your application, and notification is built into the
way the dragging is implemented.


Does this help?


Norbert Black
QSSL Training Services

Thanks for trying Nobert :slight_smile:

Nope it doesn’t help…

I’m really talking about a widget.

The widget is within a .so, the shelf loading the .so is moving
my widget around and I want to know exactly where it moves
it on the screen.

Regards.

“Norbert Black” <nblack@qnx.com> wrote in message
news:94hi4k$c30$3@nntp.qnx.com

Jean-Hugues Royer <> jhroyer@joher.com> > wrote:
Hi,

How can I be notified by a callback when a widget is moved ?
Does this help?

Does using ‘drag-event’ code help at all?
I’m not quite sure exactly what you’re doing, but my first
thought was to use this sort of approach.


Jean-Hugues Royer <jhroyer@joher.com> wrote:

Thanks for trying Nobert > :slight_smile:

Nope it doesn’t help…

I’m really talking about a widget.

The widget is within a .so, the shelf loading the .so is moving
my widget around and I want to know exactly where it moves
it on the screen.

Regards.

“Norbert Black” <> nblack@qnx.com> > wrote in message
news:94hi4k$c30$> 3@nntp.qnx.com> …
Jean-Hugues Royer <> jhroyer@joher.com> > wrote:
Hi,

How can I be notified by a callback when a widget is moved ?
Does this help?

Nope, in fact some application is moving my widget parent using Pt_ARG_POS
and I’d like to have a callback when it does.

I and my widget only exist thru a .so, the application loading the .so gives
me a parent,
I link my widget to it, and now i want to know when the application is
moving my parent
around.

Using Pt_CB_RESIZE i’ve a callback when my parent is being resized, i wish
the same
when my parent is being moved without being resized.

No window, only widgets.

Right now i’ve to check for my parent widget abs position every X ms to know
it.



“Richard Potter” <rich@qnx.com> wrote in message
news:94i7jd$pec$1@nntp.qnx.com

Does using ‘drag-event’ code help at all?
I’m not quite sure exactly what you’re doing, but my first
thought was to use this sort of approach.

Jean-Hugues Royer <jhroyer@joher.com> wrote:

Nope, in fact some application is moving my widget parent using Pt_ARG_POS
and I’d like to have a callback when it does.

I and my widget only exist thru a .so, the application loading the .so gives
me a parent,
I link my widget to it, and now i want to know when the application is
moving my parent
around.

Using Pt_CB_RESIZE i’ve a callback when my parent is being resized, i wish
the same
when my parent is being moved without being resized.

No window, only widgets.

Right now i’ve to check for my parent widget abs position every X ms to know
it.

Since we don’t currently have a callback issued when position changes you would
probably need to craft your own way to “monitor” the widgets position and notify
your app when it’s changed. Consider storing the widget’s position in a global
variable of type PhPoint_t (using the PtWidgetPos() call) Then periodically check
the widget’s position. The check would look something like:

PhPoint_t global_wgt_pos;

{

if(memcmp(&global_wgt_pos,PtWidgetPos(wgt,NULL),sizeof(global_wgt_pos))
{
// position has changed
}

}

The real dilemma here is when and how often do you check. Obviously polling defeats
the benefits of an event driven GUI (although having a really low priority thread
polling might not be such a bad thing, but it’s a bit “ugly”) You could do the
check periodically in a timer callback (although that would introduce a slight lag in
your updates) or from a work proc that gets executed automatically when all pending
events are processed.

“David LeBlanc” <dleblanc@qnx.com> wrote in message
news:94kbif$3f5$1@nntp.qnx.com

Jean-Hugues Royer <> jhroyer@joher.com> > wrote:

Right now i’ve to check for my parent widget abs position every X ms to
know
it.

Since we don’t currently have a callback issued when position changes you
would
probably need to craft your own way to “monitor” the widgets position and
notify
your app when it’s changed.

Hi David,

If you read just the last line of my post above you will see that I’m
already doing this :wink:

Regards.

Jean-Hugues Royer <jhroyer@joher.com> wrote:

“David LeBlanc” <> dleblanc@qnx.com> > wrote in message
news:94kbif$3f5$> 1@nntp.qnx.com> …
Jean-Hugues Royer <> jhroyer@joher.com> > wrote:

Right now i’ve to check for my parent widget abs position every X ms to
know
it.

Since we don’t currently have a callback issued when position changes you
would
probably need to craft your own way to “monitor” the widgets position and
notify
your app when it’s changed.

Hi David,

If you read just the last line of my post above you will see that I’m
already doing this > :wink:

Regards.

Oops. My mistake. I apologize.

But if you read just the last line of my post above you will see that I also suggested
a way other than the timer :slight_smile: