xBrowse using SetAlign provokes an error

xBrowse using SetAlign provokes an error

Postby gkuhnert » Thu Nov 04, 2010 4:34 pm

Hi,

if I use SetAlign with FW10.09 in following way:

Code: Select all  Expand view
            oLB:aCols[3]:SetAlign( AL_RIGHT )
            oLB:aCols[4]:SetAlign( AL_RIGHT )
 

with oLB being my xBrowse, I get following error:

Application
===========
Path and name: D:\cto_win\eho40\eho.exe (32 bits)
Size: 6,246,912 bytes
Time from start: 0 hours 0 mins 1 secs
Error occurred at: 04.11.2010, 17:29:40
Error description: Error BASE/1004 Class: 'NIL' has no exported method: EVAL
Args:
[ 1] = U

Stack Calls
===========
Called from: => EVAL(0)
Called from: .\source\classes\xbrowse.prg => (b)TXBROWSE:TXBROWSE(383)
Called from: => TXBROWSE:KEYCOUNT(0)
Called from: .\source\classes\xbrowse.prg => TXBROWSE:REFRESH(1127)
Called from: .\source\classes\xbrowse.prg => TXBRWCOLUMN:SETALIGN(8416)
Called from: AD_MAIN.prg => E_ADRESSEN(221)
Called from: EHO.prg => STARTADRESSEN(1257)
Called from: EHO.prg => (b)EHO_INIT(923)
Called from: .\source\classes\WINDOW.PRG => TWINDOW:KEYDOWN(2546)
Called from: .\source\classes\MDICLIEN.PRG => TMDICLIENT:KEYDOWN(243)
Called from: => TMDICLIENT:HANDLEEVENT(0)
Called from: .\source\classes\WINDOW.PRG => _FWH(3394)
Called from: => WINRUN(0)
Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE(978)
Called from: EHO.prg => MAIN(680)


If I remove the oBrw:Refresh() from SetAlign (in xBrowse.prg), the error disappears:

Code: Select all  Expand view
METHOD SetAlign( nAlign ) CLASS TXBrwColumn

   if ValType( nAlign ) == 'N'
      nAlign      := MinMax( nAlign, 0, 2 )
      if nAlign != ::nDataStrAlign
         ::nDataStrAlign      := nAlign
         ::nDataStyle         := ::DefStyle( nAlign, ::oBrw:nDataLines == 1 )
         //::oBrw:Refresh() <= I removed this line
      endif
   endif

Return Self
 


Is there a bug in this method or am I doing something wrong?
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Re: xBrowse using SetAlign provokes an error

Postby James Bott » Thu Nov 04, 2010 5:58 pm

Try putting a sysrefresh() in front of the ::oBrw:refresh().

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: xBrowse using SetAlign provokes an error

Postby gkuhnert » Fri Nov 05, 2010 8:29 am

James Bott wrote:Try putting a sysrefresh() in front of the ::oBrw:refresh().

Same error still exists...
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Re: xBrowse using SetAlign provokes an error

Postby James Bott » Fri Nov 05, 2010 5:19 pm

Gilbert,

Can you put together a small sample program showing the problem?

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: xBrowse using SetAlign provokes an error

Postby nageswaragunupudi » Sat Nov 06, 2010 1:18 pm

1. SetAlign() method is intended to be used for changing alignment during runtime. Recommended way to set alignment of columns, during initial definition of xbrowse, is by oCol:nDataStrAlign := <nAlign>.

2. From the error code, it is understood that data source is not yet specified ( in command mode ALIAS, ARRAY, RECORDSET, etc or in oops style, SetRDD, SetArray, etc ) before defining columns and properties. That is the reason bKeyCount is undefined when SetAlign is called. Recommended way is to set the data source before defining columns.

3. As our friend suggested it would be nice if u post a self contained example.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10631
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xBrowse using SetAlign provokes an error

Postby gkuhnert » Tue Nov 09, 2010 8:52 am

Rao,

nageswaragunupudi wrote:1. SetAlign() method is intended to be used for changing alignment during runtime. Recommended way to set alignment of columns, during initial definition of xbrowse, is by oCol:nDataStrAlign := <nAlign>.

Thanks, this works

nageswaragunupudi wrote:2. From the error code, it is understood that data source is not yet specified ( in command mode ALIAS, ARRAY, RECORDSET, etc or in oops style, SetRDD, SetArray, etc ) before defining columns and properties. That is the reason bKeyCount is undefined when SetAlign is called. Recommended way is to set the data source before defining columns.

Right, this was the problem

nageswaragunupudi wrote:3. As our friend suggested it would be nice if u post a self contained example.

as the problem is solved and because it was my fault: is an example still eligible?
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Re: xBrowse using SetAlign provokes an error

Postby nageswaragunupudi » Tue Nov 09, 2010 9:32 am

Glad that the problem is solved.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10631
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xBrowse using SetAlign provokes an error

Postby James Bott » Tue Nov 09, 2010 2:56 pm

as the problem is solved and because it was my fault: is an example still eligible?


Maybe a small sample showing how you got it working would help others avoid the same problem you had.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: nageswaragunupudi, RSalazarU and 85 guests