Page 1 of 1

GET MEMO command error?

Posted: Fri Sep 05, 2008 8:30 pm
by dutch
Dear Antonio,

I have used following code for normal GET. I work fine but when I use the same with MEMO field. It is not working and show this error.

Code: Select all | Expand

*--------------------------------*
Procedure MakeGet(oGet,aMField,Nr,aStruct)
// aMField := {151,'TBL->TBL_MEMO'}
// aStruct := {{'TBL_MEMO','M',10,0}}
if aStruct[ascan( aStruct , {|x| x[1]=right(aMField[Nr,2],len(aMField[Nr,2])-5) } )][2] = 'M'

REDEFINE GET oGet[Nr] VAR &(MEMVAR->aMField[Nr,2]) ;   
               MEMO ;
               ID MEMVAR->aMField[Nr,1]
else
REDEFINE GET oGet[Nr] VAR &(MEMVAR->aMField[Nr,2]) ;   
               ID MEMVAR->aMField[Nr,1]
end
return


Code: Select all | Expand

    Error description: Error Objects/8  No Object Msg.: UNDEFINED:DEFCONTROL

Stack Calls
===========
   Called from LOCKERRHAN(0)
   Called from (b)INITHANDL$(0)
   Called from DEFCONTROL(0)
   Called from TMULTIGET:REDEFINE(0)
   Called from MAKEGET(1216)
   .....


.DLL file

Code: Select all | Expand

 EDITTEXT 151, 342, 150, 59, 30, ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_BORDER | WS_VSCROLL | WS_TABSTOP

If I remark MEMO line. I show ok but I cannot try multiline text as usaul.

Regards,
Dutch

Posted: Fri Sep 05, 2008 9:07 pm
by James Bott
Dutch,

It looks like it is erroring out on this line of the Redefine method:

oWnd:DefControl( Self )

I think you need to add the OF oWnd clause.

TGet's oWnd defaults to GetWndDefault() but that is not really what you want either. TMultiGet doesn't have a default oWnd, thus the error. You should always specify the OF oWnd clause for all your controls.

Regards,
James

Posted: Sat Sep 06, 2008 3:24 pm
by dutch
Dear James,

You answer is the correct point, it works correctly.

Thanks&regards,
Dutch

Posted: Sat Sep 06, 2008 3:31 pm
by Antonio Linares
Dutch, James,

We have included DEFAULT oWnd := GetWndDefault() in Method Redefine() for next build, thanks! :-)

Posted: Sat Sep 06, 2008 5:11 pm
by James Bott
Antonio,

>We have included DEFAULT oWnd := GetWndDefault() in Method Redefine() for next build

I wonder if it wouldn't be better to let it error out? If it defaults to the wrong window as the parent it may even be harder to find the problem. What would the consequences be if it has the wrong parent window?

Regards,
James

Posted: Sat Sep 06, 2008 11:42 pm
by Antonio Linares
James,

A REDEFINE is always issued after a DEFINE DIALOG ..., and DEFINE DIALOG sets the default parent window.

Of course it is much better to specify OF oDlg, but if the programmer forgets it, FWH takes care of it.