Home
Developer Resources
QNX RTOS v4
QNX RTOS v4 Knowledge Base

QNX RTOS v4 Knowledge Base

Foundry27
Foundry27
QNX RTOS v4 project
Resources

QNX RTOS v4 Knowledge Base

Title Removing a PhAB event handler in our code
Ref. No. QNX.000009890
Category(ies) Development
Issue Our goal is to disable the process of click events on the background widget. We realize that we can BLOCK the widget with a flag, but we should also be able to remove the event handler in code using PtRemoveEventHandler() function.

Our code to remove the event handler resides in the code processed after a mouse click (Ph_EV_BUT_PRES). It looks similar to this:
x09.
x09.
x09.
x09PtRemoveEventHandler(ABW_int50back, Ph_EV_BUT_PRESS, mouseclick, NULL);
x09.
x09.
x09.

Solution This fails because PhAB callbacks are not attached to your code. Instead, PhAB attaches a stub function that calls your code.
Even if we give you the name of thet function, it wouldn't help you much, because you wouldn't be able to remove it without knowing the correct value for the 'data' argument, which is an array item whose index can change each time PhAB re-generates the application.

In short, you can only remove the callback that you have added in your code. To disable a PhAB callback you will have to test a global flag in your callback function.

To get the 'data' argument right when doing create or remove in code, you must match the data you pass to PtRemoveEventHandler() and the data that you passed to PtAddEventHandler().
You decide what exectly it is (using NULL for boath is fine).