menu widget address

hi,

for my application i want to create popup menu. this popup menu is same as
the menu available on menubar.

from qnx help doc. i found the example for creating popup menu. in that
example they have created menu at runtime and used the same menu pointer for
creating popup menu on right click.

now, in my application i have already created a menu at design time and i
want to call the same menu as popup menu on click on some widget. but as
they have used menu widget ptr for creating popup menu and positioning it, i
am not able to get the menu widget pointer.

following code returns the Window widget pointer only,

MenuWidget = ApGetWidgetPtr(ABW_Window, ABN_Menu);
PtPositionWidtet(MenuWidget, Event);
PtRealizeWidget(MenuWidget);

this result in moving the position of the window.

i also tried by traversing the widget tree (ABW_Window as root) and tried to
find the widget of the class PtMenu in it. but i not find any entry in it.


now, for creating popup menu do i have to create menu run time only or i can
access the menu created at design time ?

thank you in advance

sameer

Hello Sam

sam wrote:

hi,

for my application i want to create popup menu. this popup menu is same as
the menu available on menubar.

from qnx help doc. i found the example for creating popup menu. in that
example they have created menu at runtime and used the same menu pointer for
creating popup menu on right click.

now, in my application i have already created a menu at design time and i
want to call the same menu as popup menu on click on some widget. but as
they have used menu widget ptr for creating popup menu and positioning it, i
am not able to get the menu widget pointer.

following code returns the Window widget pointer only,

MenuWidget = ApGetWidgetPtr(ABW_Window, ABN_Menu);
PtPositionWidtet(MenuWidget, Event);
PtRealizeWidget(MenuWidget);

You don’t want to use ApGetWidgetPtr, You want to use ApCreateModule.
You should do the following ( make sure you have setup an internal link
for the menu widget )

MenuWidget - ApCreateModule ( ABM_Menu, ABW_base, NULL )
PtPositionWidget ( MenuWidget, Event );
PtRealizeWidget ( MenuWidget );

Thanks,
Rodney



this result in moving the position of the window.

i also tried by traversing the widget tree (ABW_Window as root) and tried to
find the widget of the class PtMenu in it. but i not find any entry in it.


now, for creating popup menu do i have to create menu run time only or i can
access the menu created at design time ?

thank you in advance

sameer