Calling Function

Calling Function

Postby sajith » Sat May 30, 2009 11:28 am

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  Expand view


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
..................................
..................................
.................................
 
sajith
 
Posts: 110
Joined: Wed Feb 18, 2009 9:58 am
Location: India

Re: Calling Function

Postby anserkk » Sat May 30, 2009 11:58 am

Dear Sajith,

You need to use the statement BLOCK

For Eg.

Code: Select all  Expand view
// 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
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Calling Function

Postby nageswaragunupudi » Sat May 30, 2009 2:48 pm

If you are using xHarbour, you can write your code like this also:
Code: Select all  Expand view
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
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Calling Function

Postby sajith » Mon Jun 01, 2009 6:21 am

Dear, Anser & Rao
Many thanks for ur reply ur code works fine.My problem is solved
Regards,
sajith
sajith
 
Posts: 110
Joined: Wed Feb 18, 2009 9:58 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], nageswaragunupudi and 103 guests