GET MEMO command error?

Post Reply
User avatar
dutch
Posts: 1554
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

GET MEMO command error?

Post 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
User avatar
James Bott
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post 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
User avatar
dutch
Posts: 1554
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Post by dutch »

Dear James,

You answer is the correct point, it works correctly.

Thanks&regards,
Dutch
User avatar
Antonio Linares
Site Admin
Posts: 42519
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 75 times
Contact:

Post by Antonio Linares »

Dutch, James,

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

Antonio Linares
www.fivetechsoft.com
User avatar
James Bott
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 42519
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 75 times
Contact:

Post 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.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply