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.