Error in code

Error in code

Postby sajith » Tue Feb 24, 2009 8: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
sajith
 
Posts: 110
Joined: Wed Feb 18, 2009 9:58 am
Location: India

Re: Error in code

Postby anserkk » 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: Select all  Expand view

#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
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Error in code

Postby Antonio Linares » Tue Feb 24, 2009 1: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Error in code

Postby anserkk » Tue Feb 24, 2009 2:24 pm

Dear Mr.Antonio,

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

Regards

Anser
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 83 guests