A strange Error

A strange Error

Postby lailton.webmaster » Fri Feb 04, 2011 2:31 am

Hi Guys,

I can't use inside FOR/NEXT "REDEFINE GET ...."

It´s a sample of error:

Code: Select all  Expand view
Function Test()
Local oDlg
Local aVar := {"1","2","3"}
Local aGet := Array( 3 )
Local nNum
Define Dialog oDlg
For  nNum := 1 To 3
 nID := 4000 + nNum // I´ve IDs(4001,4002,4003) in resource from pelles ( all Gets ).
 Redefine Get aGet[nNum] Var aVar[nNum] ID nID Of oDlg
Next nNum
Activate Dialog oDlg
Return Nil


It´s compile, more Var was lost. no display correcty values.

Code: Select all  Expand view
Function Test()
Local oDlg
Local aVar := {"1","2","3"}
Local aGet := Array( 3 )
Local nNum
Define Dialog oDlg
For  nNum := 1 To 2
 nID := 4000 + nNum // I´ve IDs(4001,4002,4003) in resource from pelles ( all Gets ).
 Redefine Get aGet[nNum] Var aVar[nNum] ID nID Of oDlg // it´s wrong vars vaues is incorrect.
Next nNum
Redefine Get aGet[3] Var aVar[3] ID 4003 Of oDlg // it´s ok
Activate Dialog oDlg
Return Nil


My Solucion was do without use For/Next.

:D ( confuse,,, logic is correct,,, I´cant understand why... )
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: A strange Error

Postby Daniel Garcia-Gil » Fri Feb 04, 2011 3:04 am

Hello

Try

Code: Select all  Expand view
#include "fivewin.ch"

Function Main()
   Local oDlg
   Local aVar := {"1","2","3"}
   Local aGet := Array( 3 )
   Local nNum, uVar := 1
   Define Dialog oDlg
   For  nNum := 1 To 3
    @ nNum * 10, 10  Get aGet[nNum] Var uVar Of oDlg pixel size 25, 10
    aGet[nNum]:bSetGet = BuildSetGet( aVar, nNum )
    aGet[nNum]:oGet:Block = BuildSetGet( aVar, nNum )
   Next nNum
   Activate Dialog oDlg
Return Nil

function BuildSetGet( aVar, n )
return bSETGET( aVar[ n ] )
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita


Return to FiveWin for Harbour/xHarbour

Who is online

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