FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Error in code
Posts: 110
Joined: Wed Feb 18, 2009 09:58 AM
Error in code
Posted: Tue Feb 24, 2009 08:09 AM

can someone help me to correct the error.
Error:= oMenu:Action( oWnd:End()) why my oWnd(Object) becomes nil.I doent want oWnd to declare static

include "FiveWin.ch"

-------------------------------------------------------------------
FUNCTION main()
-------------------------------------------------------------------

LOCAL oWnd

DEFINE Window oWnd;
Title "ListBox";
Menu BuildMenu(oWnd)

Activate Window oWnd

RETURN nil

-------------------------------------------------------------------
FUNCTION BuildMenu(oWnd)
-------------------------------------------------------------------
LOCAL oMenu

Menu oMenu

  MenuItem "File"
  Menu
  MenuItem "CreateList"

  separator

  MenuItem "Exit"

  IF  oWnd !=nil
  oMenu:Action( oWnd:End())//ERROR//
  ENDif

  ENDMenu

ENDMenu

RETURN oMenu

Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Error in code
Posted: Tue Feb 24, 2009 10:02 AM
Dear Sajith,

Instead of oWnd:End() Try WndMain():End(). I don't know why it is so.
Code (fw): Select all Collapse
#include "FiveWin.ch"
*-------------------------------------------------------------------*
FUNCTION main()
*-------------------------------------------------------------------*
LOCAL oWnd

DEFINE Window oWnd;
       Title "ListBox" ;
       Menu BuildMenu() 

Activate Window oWnd
RETURN nil

*-------------------------------------------------------------------*
FUNCTION BuildMenu()
*-------------------------------------------------------------------*
LOCAL oMenu,oWnd:=WndMain()

MENU oMenu
   MenuItem "File"
   MENU
     MenuItem "CreateList"
     separator
     MenuItem "Exit" ACTION WndMain():End(.T.) // I don't know why oWnd:End() doesn't work here

   ENDMENU

ENDMENU

RETURN oMenu


Regards

Anser
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Error in code
Posted: Tue Feb 24, 2009 01:06 PM

Sajith, Anser,

> ... Menu BuildMenu(oWnd)

When BuildMenu( oWnd ) is called, oWnd has not been created yet :-)

thats why it does not work.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Error in code
Posted: Tue Feb 24, 2009 02:24 PM

Dear Mr.Antonio,

Thankyou for the info. :) I guessed this could be the reason.

Regards

Anser

Continue the discussion