FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Calling Function
Posts: 110
Joined: Wed Feb 18, 2009 09:58 AM
Calling Function
Posted: 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 (fw): Select all Collapse
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:oLastItem:cPrompt +"(" + ")" )
    END do
   EndMenu
END IF
..................................
..................................
.................................
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Calling Function
Posted: Sat May 30, 2009 11:58 AM
Dear Sajith,

You need to use the statement BLOCK

For Eg.

Code (fw): Select all Collapse
// 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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Calling Function
Posted: Sat May 30, 2009 02:48 PM
If you are using xHarbour, you can write your code like this also:
Code (fw): Select all Collapse
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
Posts: 110
Joined: Wed Feb 18, 2009 09:58 AM
Re: Calling Function
Posted: Mon Jun 01, 2009 06:21 AM

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

Continue the discussion