Página 1 de 1
Menu Action in CODE
Publicado: Vie Ago 24, 2007 3:48 pm
por ChrisGillard
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
Menu Action in CODE
Publicado: Vie Ago 24, 2007 5:28 pm
por notengo
Chris,
> MENUITEM "Browse this DBF" ACTION { | oSender | BrowseDbf( oSender ) }
> I am really just wanting to ACTION a FUNCTION,
Then call it as a function:
MENUITEM "Browse this DBF" ACTION BrowseDbf( oSender )
Hope it helps.
Regards,
José Lalín
Menu Action in CODE
Publicado: Vie Ago 24, 2007 5:28 pm
por notengo
Chris,
> MENUITEM "Browse this DBF" ACTION { | oSender | BrowseDbf( oSender ) }
> I am really just wanting to ACTION a FUNCTION,
Then call it as a function:
MENUITEM "Browse this DBF" ACTION BrowseDbf( oSender )
Hope it helps.
Regards,
José Lalín
Menu Action in CODE
Publicado: Lun Ago 27, 2007 12:52 pm
por ChrisGillard
Hi Jose,
Thanks for the reply ...
I dont think its quite as simple as that in my situation ... calling my
function does not work for me.
I have distilled into smallest project I can make.
Possibly its because I am making the Menu at runtime when the right click
happens ??
I have tried making the menu in the MakeFormInCode() function ... but still
I get NO ACTION.
Possibly, even probably I am doing things in a strange way ?!
Any help would be appreciated.
Regards
Chris
"José Lalín" <
notengo@correo.com> wrote in message
news:[email=
46cef962@ozsrv2.ozlan.local...]
46cef962@ozsrv2.ozlan.local...[/email]
>
> Chris,
>
>> MENUITEM "Browse this DBF" ACTION { | oSender | BrowseDbf(
>> oSender ) }
>> I am really just wanting to ACTION a FUNCTION,
>
> Then call it as a function:
>
> MENUITEM "Browse this DBF" ACTION BrowseDbf( oSender )
>
> Hope it helps.
>
> Regards,
> José Lalín
Attached files Form_code.zip (2.2 KB)Â
Menu Action in CODE
Publicado: Lun Ago 27, 2007 12:52 pm
por ChrisGillard
Hi Jose,
Thanks for the reply ...
I dont think its quite as simple as that in my situation ... calling my
function does not work for me.
I have distilled into smallest project I can make.
Possibly its because I am making the Menu at runtime when the right click
happens ??
I have tried making the menu in the MakeFormInCode() function ... but still
I get NO ACTION.
Possibly, even probably I am doing things in a strange way ?!
Any help would be appreciated.
Regards
Chris
"José Lalín" <
notengo@correo.com> wrote in message
news:[email=
46cef962@ozsrv2.ozlan.local...]
46cef962@ozsrv2.ozlan.local...[/email]
>
> Chris,
>
>> MENUITEM "Browse this DBF" ACTION { | oSender | BrowseDbf(
>> oSender ) }
>> I am really just wanting to ACTION a FUNCTION,
>
> Then call it as a function:
>
> MENUITEM "Browse this DBF" ACTION BrowseDbf( oSender )
>
> Hope it helps.
>
> Regards,
> José Lalín
Attached files Form_code.zip (2.2 KB)Â
Menu Action in CODE
Publicado: Lun Ago 27, 2007 12:58 pm
por notengo
Chris,
I've just tested your project and doing the change I suggested in my
previous message all works as expected. See the screenshot:
Regards,
José Lalín
--
Menu Action in CODE
Publicado: Lun Ago 27, 2007 12:58 pm
por notengo
Chris,
I've just tested your project and doing the change I suggested in my
previous message all works as expected. See the screenshot:
Regards,
José Lalín
--
Menu Action in CODE
Publicado: Lun Ago 27, 2007 1:08 pm
por ChrisGillard
Jose,
Thanks for the V.Quick response !! ... its a national holiday here but would
like to solve this problem.
I have just tried what I think you mean & get no action.
I am obviously doing something stupid.
Can you send me your amended progaram please.
Chris
"José Lalín" <
notengo@correo.com> wrote in message
news:[email=
46d2ae81@ozsrv2.ozlan.local...]
46d2ae81@ozsrv2.ozlan.local...[/email]
>
> Chris,
>
> I've just tested your project and doing the change I suggested in my
> previous message all works as expected. See the screenshot:
>
> Regards,
> José Lalín
>
Menu Action in CODE
Publicado: Lun Ago 27, 2007 1:08 pm
por ChrisGillard
Jose,
Thanks for the V.Quick response !! ... its a national holiday here but would
like to solve this problem.
I have just tried what I think you mean & get no action.
I am obviously doing something stupid.
Can you send me your amended progaram please.
Chris
"José Lalín" <
notengo@correo.com> wrote in message
news:[email=
46d2ae81@ozsrv2.ozlan.local...]
46d2ae81@ozsrv2.ozlan.local...[/email]
>
> Chris,
>
> I've just tested your project and doing the change I suggested in my
> previous message all works as expected. See the screenshot:
>
> Regards,
> José Lalín
>
Menu Action in CODE
Publicado: Lun Ago 27, 2007 1:18 pm
por notengo
Chris,
sure, here it is.
Regards,
José Lalín
--
Menu Action in CODE
Publicado: Lun Ago 27, 2007 1:18 pm
por notengo
Chris,
sure, here it is.
Regards,
José Lalín
--
Menu Action in CODE
Publicado: Lun Ago 27, 2007 1:36 pm
por ChrisGillard
Jose,
Thanks .. I am there now.
My code is like yours now plus I needed to put the line below in a block to
stop it executing the menu as the form was first displayed.
// This needed to be in a block to stop it executing immediately
oForm:OnConTextmenu := { | | MakeContextMenu( oForm ) }
Apologies for being a bit dim on this one.
Regards
Chris
"José Lalín" <
notengo@correo.com> wrote in message
news:[email=
46d2b354@ozsrv2.ozlan.local...]
46d2b354@ozsrv2.ozlan.local...[/email]
>
> Chris,
>
> sure, here it is.
>
> Regards,
> José Lalín
>
>
Menu Action in CODE
Publicado: Lun Ago 27, 2007 1:36 pm
por ChrisGillard
Jose,
Thanks .. I am there now.
My code is like yours now plus I needed to put the line below in a block to
stop it executing the menu as the form was first displayed.
// This needed to be in a block to stop it executing immediately
oForm:OnConTextmenu := { | | MakeContextMenu( oForm ) }
Apologies for being a bit dim on this one.
Regards
Chris
"José Lalín" <
notengo@correo.com> wrote in message
news:[email=
46d2b354@ozsrv2.ozlan.local...]
46d2b354@ozsrv2.ozlan.local...[/email]
>
> Chris,
>
> sure, here it is.
>
> Regards,
> José Lalín
>
>
Menu Action in CODE
Publicado: Lun Ago 27, 2007 1:42 pm
por notengo
Chris,
> Thanks .. I am there now.
Glad to hear that !
> Apologies for being a bit dim on this one.
No need to apologize

Regards,
José Lalín
Menu Action in CODE
Publicado: Lun Ago 27, 2007 1:42 pm
por notengo
Chris,
> Thanks .. I am there now.
Glad to hear that !
> Apologies for being a bit dim on this one.
No need to apologize

Regards,
José Lalín