GET MEMO command error?

GET MEMO command error?

Postby dutch » Fri Sep 05, 2008 8:30 pm

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 view
*--------------------------------*
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 view
    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 view
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
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby James Bott » Fri Sep 05, 2008 9:07 pm

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

Postby dutch » Sat Sep 06, 2008 3:24 pm

Dear James,

You answer is the correct point, it works correctly.

Thanks&regards,
Dutch
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby Antonio Linares » Sat Sep 06, 2008 3:31 pm

Dutch, James,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby James Bott » Sat Sep 06, 2008 5:11 pm

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

Postby Antonio Linares » Sat Sep 06, 2008 11:42 pm

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
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 26 guests