Menu Action in CODE
Publicado: Vie Ago 24, 2007 3:48 pm
Am trying to create a general purpose dbf viewer for my applications.
I have an array browse in a form of all dbfs open in my application.
I want to right click on a dbf in the browse & dbfbrowse that dbf.
I am assigning the onContextMenu of first browse as so :
oBrowse:OnContextMenu := { | oSender, nPosX, nPosY | DbfBrowseContextMenu(
oSender, nPosX, nPosY ) }
&
FUNCTION DbfBrowseContextMenu( oSender, nPosX, nPosY )
local oMenu
IF ! oSender:SelectCellFromPoint( nPosX, nPosY )
return nil
ENDIF
MENU POPUP oMenu
MENUITEM "Browse this DBF" ACTION { | oSender | BrowseDbf( oSender ) }
// ::Process( oSender ) // ::DelListBoxitem()
ENDMENU
oSender:ShowPopupMenu( oMenu, nPosX, nPosY )
RETURN Nil
FUNCTION BrowseDbf( oSender )
MsgInfo( "Hi" ) // Will make a second form & dbfbrowse the dbf clicked
on.
RETURN( NIL )
The menu pops up fine but I cannot get it to action my BrowseDbf() function.
Have tried various ways of defining the MENUITEM ACTION in code.
Help says about the action having to be a 'method' which I have used OK in
another place.
I am really just wanting to ACTION a FUNCTION,
Hopefully this can be done ??
Any help would be appreciated.
Regards
Chris Gillard
I have an array browse in a form of all dbfs open in my application.
I want to right click on a dbf in the browse & dbfbrowse that dbf.
I am assigning the onContextMenu of first browse as so :
oBrowse:OnContextMenu := { | oSender, nPosX, nPosY | DbfBrowseContextMenu(
oSender, nPosX, nPosY ) }
&
FUNCTION DbfBrowseContextMenu( oSender, nPosX, nPosY )
local oMenu
IF ! oSender:SelectCellFromPoint( nPosX, nPosY )
return nil
ENDIF
MENU POPUP oMenu
MENUITEM "Browse this DBF" ACTION { | oSender | BrowseDbf( oSender ) }
// ::Process( oSender ) // ::DelListBoxitem()
ENDMENU
oSender:ShowPopupMenu( oMenu, nPosX, nPosY )
RETURN Nil
FUNCTION BrowseDbf( oSender )
MsgInfo( "Hi" ) // Will make a second form & dbfbrowse the dbf clicked
on.
RETURN( NIL )
The menu pops up fine but I cannot get it to action my BrowseDbf() function.
Have tried various ways of defining the MENUITEM ACTION in code.
Help says about the action having to be a 'method' which I have used OK in
another place.
I am really just wanting to ACTION a FUNCTION,
Hopefully this can be done ??
Any help would be appreciated.
Regards
Chris Gillard