Calling Function

Post Reply
sajith
Posts: 110
Joined: Wed Feb 18, 2009 9:58 am
Location: India
Contact:

Calling Function

Post by sajith »

Hello,can Some Help me

Iam populating Menu frm Database(Mysql).In the Action event iam getting the Form Name + Appending the "( )" to call perticular form

For Example if the formname is "Wage" iam appending "( )" to get "Wage()" to call that function .Here
iam getting name correctly but Function is not invoked .can some Help me

Code: Select all


WHILE  ! oRecMenu:BOF() .AND. ! oRecMenu:EOF()
  IF oRecMenu:Fields("MenuName"):Value=="Master"
      MENUITEM  ""+oRecMenu:Fields("MenuName"):Value+""
      oRecMenuHierarchy:=LoadMenuHeirarchy(Str( oRecMenu:Fields("menuId"):Value))
     MENU   POPUP
   WHILE  ! oRecMenuHierarchy:BOF() .AND. ! oRecMenuHierarchy:EOF()

         MENUITEM oMItem1 PROMPT  ""+oRecMenuHierarchy:Fields("MenuHierarchy"):Value+"";
      Action(oMItem1:oMenu:oLastItem:cPrompt +"(" + ")")//Here iam getting Function name(Wage()) But  Function is not 
//Invoked 
                  SEPARATOR
                oRecMenuHierarchy:MoveNext()
           //( oMItem1:oMenu:oLastItem:cPrompt +"(" + ")" )
    END do
   EndMenu
END IF
..................................
..................................
.................................
 
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Calling Function

Post by anserkk »

Dear Sajith,

You need to use the statement BLOCK

For Eg.

Code: Select all

// Menu Display Text
cMenuText:=Alltrim(oRecSet:Fields("Menu_Text"):Value) 

// Convert Menu action to a code block
cMenuAction:="{ || "+LTrim(RTrim(oRecSet:Fields("Menu_Action"):Value))+" }"

MENUITEM cMenuText BLOCK &(cMenuAction)
Regards

Anser
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Calling Function

Post by nageswaragunupudi »

If you are using xHarbour, you can write your code like this also:

Code: Select all

MENUITEM oMItem1 PROMPT  oRecMenuHierarchy:Fields( "MenuHierarchy" ):Value ;   
   ACTION HB_ExecFromArray( oMItem1:oMenu:oLastItem:cPrompt )
 
This approach is simpler and does not have to concat strings and do macro evaluation
Regards

G. N. Rao.
Hyderabad, India
sajith
Posts: 110
Joined: Wed Feb 18, 2009 9:58 am
Location: India
Contact:

Re: Calling Function

Post by sajith »

Dear, Anser & Rao
Many thanks for ur reply ur code works fine.My problem is solved
Regards,
sajith
Post Reply