Right click menu

For questions and postings not covered by the other forums
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Right click menu

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:31 pm

by Anonymous >> Thu, 22 Jan 2004 19:09:21 GMT

Using the Painter, how is a generic right click menu made?

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Right click menu

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:31 pm

by Richard Barrington >> Thu, 22 Jan 2004 19:55:58 GMT

You probably want to look into the contextMenu event, the popupMenu method, and creating hidden menus made in Painter.

There's a note in the Tech Tip Techniques list referencing that, and the PDF documenation covers the details.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Right click menu

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:31 pm

by cnwdad1 >> Thu, 22 Jan 2004 20:43:20 GMT

With the form open in the Painter, click the "Menu Design" button on the toolbar to define the menu. You'll probably want to set the menu's "visible" property to false ?

Back in the Development window, you need to decide where you want the popup menu to be activated from, i.e. when the right-click occurs over a listbox, a table or some other control. On that control, code something like the following in the "mouseDown" event method:

lstRunning_mouseDown(listbox: ListBox input; button: Integer; shift: Integer; x: Real; y: Real) updating;
vars
actualXPos : Real;
actualYPos : Real;begin

if button = Window.MouseButton_Right then
actualXPos := x;
actualYPos := y;

self.cnEcGetRelativePosition(listbox, actualXPos, actualYPos);
self.popupMenu(mnuQueue, actualXPos.Integer, actualYPos.Integer); endif;
end;

.....this event method will show a popup menu called "mnuQueue". The "cnEcGetRelativePosition" method does the following:

cnEcGetRelativePosition(pWindowObj:Window input; pXposition:Real io; pYposition:Real io) updating;begin

pWindowObj.windowToScreen(pXposition, pYposition);
self.screenToWindow(pXposition, pYposition);
end;

.....this method takes the coordinates of the mouse pointer where the right-click occurred, and converts them to the appropriate screen position so that the popup menu appears exactly at the coordinates of the mouse pointer.

regards,
darrell.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Right click menu

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:31 pm

by Anonymous >> Sun, 25 Jan 2004 18:37:11 GMT

Thanks alot fo all the help!

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Right click menu

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:31 pm

by sfgwsdgfr >> Tue, 27 Apr 2004 5:49:22 GMT

xfgxdfg


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 25 guests