Cómo crear gets dentro de un bucle For...Next

Cómo crear gets dentro de un bucle For...Next

Postby Rafael Clemente » Fri Mar 30, 2007 11:34 am

Me gustaría poder crear 30 gets dentro de un bucle For... next. Algo más o menos así:
Code: Select all  Expand view
// --- Initialize
oGet := {}
aGet := {}
For i := 1 TO 30
     AADD(oGet, Nil)
     AADD(aGet, Str(i))
Next
// --- Create Gets:
nR := 0; nC := 0
For i := 1 TO 30
     nR, nC GET oGet[i] Var aGet[i]
     nR += 1
Next

Pero este ejemplo no funciona. Todos los gets muestran el mismo valor 30, o sea, el balor final del For... next). Llevo un buen rato dándole vueltas pero estoy bloqueado. Alguien podría sugerirme cómo hacerlo?

Rafael
User avatar
Rafael Clemente
 
Posts: 365
Joined: Sat Oct 08, 2005 7:59 pm
Location: Barcelona, Spain

Postby alex_cyr » Sat Mar 31, 2007 12:05 am

que tal rafael, se que esto declara muchas variables publicas pero no encontre otra forma, cualquier sugerencia bienvenida; mira yo lo resolvi asi:

public wcampo1,wcampo2,wcampo3...

for j = 1 to 30
wvar := 'wcampo'+trim(str(j,2)) //WVAR no tiene declaracion previa
@ ren ,col get aGets[j] VAR &wvar OF ODlg PIXEL SIZE 40,10
next n
alex_cyr
 
Posts: 77
Joined: Wed Jun 28, 2006 6:38 pm
Location: Chihuahua

Postby Rafael Clemente » Sat Mar 31, 2007 7:39 am

Alex:
Enrico, en el Forum en inglés, me ha dado una solución muy elegante que funciona perfecto y no consume variables públicas. La tienes en :

http://fivetechsoft.com/forums/viewtopi ... 9111#29111

Gracias y un saludo,
Rafael
User avatar
Rafael Clemente
 
Posts: 365
Joined: Sat Oct 08, 2005 7:59 pm
Location: Barcelona, Spain


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: cmsoft, Google [Bot], wilsongamboa and 119 guests