Accessing VX-REXX fields 
Author Message
 Accessing VX-REXX fields

--
I just installed VX-REXX on my system.  I'm really starting to like it.  I have one question that I can't figure out though.  I have a bunch of fields on the screen that form a 6 row by 4 column matrix.  I have them named as follows
EF_Score.1.1
EF_Score.1.2
.
.
.
EF_Score.6.4

I want to fill these fields from a corresponding array in my code.  I was hoping I could do something like the following but couldn't get it to work
Do I1 = 1 to 6
   Do I2 = 1 to 4
      ok = VRSET("EF_Score".I1.I2, value, scores.i1.i2)
   End
End

Instead I had to do one VRSET for each element in the matrix.

Does anyone know a syntax I can use to do it in the loop?

Bill Harrison



Tue, 21 Apr 1998 03:00:00 GMT  
 Accessing VX-REXX fields
On Fri, 3 Nov 1995 21:19:19 GMT William Harrison said:

Quote:
>one question that I can't figure out though.  I have a bunch of fields on the
>screen that form a 6 row by 4 column matrix.  I have them named as follows
>EF_Score.1.1
>EF_Score.1.2
>.
>EF_Score.6.4

>I want to fill these fields from a corresponding array in my code.  I was
>hoping I could do something like the following but couldn't get it to work
>Do I1 = 1 to 6
>   Do I2 = 1 to 4
>      ok = VRSET("EF_Score".I1.I2, value, scores.i1.i2)
>   End
>End

>Instead I had to do one VRSET for each element in the matrix.

>Does anyone know a syntax I can use to do it in the loop?

Change it to
      ok = VRSET("EF_Score." || i1 || '.' || i2, 'value', scores.i1.i2)

The periods before i1 and i2 should be part of a stemmed variable,
but in your code they follow a literal. So Rexx doesn't replace them
with their values and you have (for any values of i1 and i2)
    vrset("EF_Score.I1.I2", ....
It is safer to quote the second argument ('value') in case you have
a variable called value.



Thu, 23 Apr 1998 03:00:00 GMT  
 Accessing VX-REXX fields
How about:

do i1=1 to 6
  do i2=1 to 4
    ok = vrset('ef_score.'i1'.'i2,'value',scores.i1.i2)
  end
end

Key here is that you need to "build" the entry field names by concatenating strings (specifying .i1.i2 amounted to (I think), a period preceding the uninitialized variable "i1.i2", which isn't what you intended).  Also, whenever you intend to send a literal value to a function (in this case "value"), you should put it in quotes/aposts.  Otherwise, the symbol may have been used as a variable and you will end up sending the symbol's value, rather than its name (hence quotes around the argument "value").

Hope this works ...



Sun, 26 Apr 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. VX-REXX Entry field: disable makes text illegible

2. VX Rexx Memory Access

3. VX Rexx Memory Access

4. Vispro Rexx vs VX - Rexx

5. VX-REXX/REXX dialog trouble in OS/2 w/ FP17

6. VisPro/Rexx vs VX-REXX

7. VX-REXX to any REXX on NT

8. VisPro Rexx or VX-Rexx ?

9. Object REXX/VX-REXX DB problems

10. VX-REXX and Object REXX under OS/2

11. Object REXX & VX-REXX under OS/2

12. Creation of GIF/BMP with REXX and VX-REXX in OS/2

 

 
Powered by phpBB® Forum Software