RE: Converting a string to a variable name

new topic     » goto parent     » topic index » view thread      » older message » newer message

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_000_01C2375F.7F5AE7C0
 charset=iso-8859-1

Hi Rubens,
There is always more than one way to achieve your goals in programming. Here
is a method that I might've used...

 include Win32lib.ew
 --------------------------------------------------------------
 ------------------
 --  Window Window1
 constant Window1 = createEx( Window, "", 0, Default, Default, 602, 338, 0,
0 )
 
 sequence etid etid = {}
 
 etid &= createEx( EditText, "100", Window1, 8,  32, 70, 20, 0, 0 )
 etid &= createEx( EditText, "100", Window1, 8,  56, 70, 20, 0, 0 )
 etid &= createEx( EditText, "100", Window1, 8,  80, 70, 20, 0, 0 )
                         .
                          .
                          .and so on... a lot.
 
 object etext
 integer cnt
 etext=gets(arquivo) --------some txt archive
 cnt = 1
 while sequence(etext) and cnt <= length(etid) do
   etext=etext[1..length(etext)-1]
   setText(etid[cnt],etext)
   etext = gets(arquivo)
   cnt += 1
 end while

> -----Original Message-----
> From: rubis at fem.unicamp.br [mailto:rubis at fem.unicamp.br]
> Sent: Tuesday, 30 July 2002 10:00
> To: EUforum
> Subject: RE: Converting a string to a variable name
> 
> 
> 
> Hi all !
> Thanks all for the "lessons" :>)
> As i'm starting in Euphoria, i'm always learning with this 
> forum. The best 
> manual for Euphoria is here. :>)
> 
> Now I will explain why I cannot use arrays in my program :
> 
> This is my program: (Win32)
> --------------------------------------------------------------
> --------------------------------------------------------------
> --------------
> include Win32lib.ew
> --------------------------------------------------------------
> ------------------
> --  Window Window1
> constant Window1 = createEx( Window, "", 0, Default, Default, 
> 602, 338, 0, 0 )
> 
> object etext1,etext2,etext3...
> 
> constant EditText1 = createEx( EditText, "100", Window1, 8, 
> 32, 70, 20, 0, 0 )
> constant EditText2 = createEx( EditText, "100", Window1, 8, 
> 56, 70, 20, 0, 0 )
> constant EditText3 = createEx( EditText, "100", Window1, 8, 
> 80, 70, 20, 0, 0 )
>                          .
>                          .
>                          .and so on... a lot.
> 
> I have to change the value "100"  in the EditText1, 
> EditText2... and so 
> on... to values from etext1, etext2 and so...
> 
> The only way i find to do this is:
> 
> etext1=gets(arquivo)                             --------some 
> txt archive
> etext1=etext1[1..length(etext1)-1]
> setText(EditText1,etext1)
> etext2=gets(arquivo)
> etext2=etext2[1..length(etext2)-1]
> setText(EditText2,etext2)
> etext3=gets(arquivo)
> etext3=etext3[1..length(etext3)-1]
> .
> .
> .one by one.... and a ugly code.
> 
> This is what will be nice to do...
> 
> for x=1 to .. do ----   until the end of the file
> etext&x=gets(arquivo)
> setText(EditText&x,etext&x) ------------------------ set 
> EditText1 to value 
> etext1
> end if
> 
> nice code... but does not work.
> 
> I didn't try using arrays still now, but ...does this work ?
> 
> for x=1 to 10 do
> etext[x]=gets(arquivo)
> setText(EditText[x],etext[x]) ------------------------ set 
> EditText1 to 
> value etext1
> end if

-------------
Derek

==================================================================
De informatie opgenomen in dit bericht kan vertrouwelijk zijn en 
is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht 
onterecht ontvangt wordt u verzocht de inhoud niet te gebruiken en 
de afzender direct te informeren door het bericht te retourneren. 
==================================================================
The information contained in this message may be confidential 
and is intended to be exclusively for the addressee. Should you 
receive this message unintentionally, please do not use the contents 
herein and notify the sender immediately by return e-mail.


==================================================================

------_=_NextPart_000_01C2375F.7F5AE7C0
Content-Type: application/ms-tnef

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu