Wednesday, October 6, 2010

How to program Right Click Event in Powerbuilder

As we know at least there are 2 buttons in every mouse that you use with your computer. Known as Left and Right button.

For right-handed user, Left Button is for SELECT purpose. And Right button usually is for displaying the Popup Menu to shortcut the steps.

Now, I am trying to explain how to script Right button to show the Popup Menu in Powerbuilder.

In almost objects in Powerbuilder, there is an event called RBUTTONDOWN. In this case I will use with Windows object.

First, you need to create Menu object with 3 choices, then save as m_rightpopup.

Create new window and save as w_main, and put this script at RBUTTONDOWN event.

1:  m_rightpopup popMenu  
2:  popMenu = CREATE m_rightpopup  
3:  popMenu.PopMenu(w_main.PointerX(), w_main.PointerY())  

The script above, will shown a Popup Menu when you try to click the right button of your mouse, located exactly at your mouse pointer

No comments:

Post a Comment