April 28, 2024, 07:28:19 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


two different displays, but both depend on same variables

Started by hugh, August 15, 2008, 07:11:38 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

hugh

this is part of the code which sets up the variables, the variable [number] is set to either 75 or 90 depending on users input.


     if number = 90 THEN
     colums = 10
     rowes = 10
     ENDIF


     if  number = 75 THEN
     colums = 15
     rowes = 6
     ENDIF

     if sw >=1020 and sh >= 768 and number = 90 THEN
     cc = 50
     numw = 470
     numl = 430
     ENDIF

    if sw >= 1020 and sh >= 768 and number = 75 THEN:         /* sw= screenwidth */
    numw = 700                                                                   /*numw = width of 10 numbers with cc [50] spaces between each number */
    numl = 250                                                                     /*numl = height of numbers, ie 8 rows with cc spaces between each */
    cc = 50                                                                          /* cc is the space between each column and row, also with cc+20=start row */
    ENDIF




now when i run the code listed below, i get a perfect display of 10 columns x 9 rows ; ie numbers 1 to 90.
but . WHY?, do i only get 6 columns x 5 rows instead of 15 columns x 5 rows ; ie numbers 1 to 75


r= cc +20                           /* cc = 30 or 40 or 50, space between displayed numbers*/                         
for y=1 to number step colums   /* 10 or 15 numbers per row*/
c= (sw-numw)/2              /* column start  sw=1280 numw=700 if number=75 else = 470 */                     
for x=1 to rowes
z=x+y-1               
            SETLINESTYLE w1, @LSSOLID, 2
CONTROL w1,@STATIC,ltrim$(str$(z)),c,r,20,18,1, z
           SETCONTROLCOLOR(w1,z,RGB(20,20,20),RGB(0,50,0))
      circle w1,c+10,r+10,15,rgb(0,0,0),rgb(0,50,0)       
        c=c+cc         
next x
r=r+cc
next y



any clues, if it works for one set of numbers, then ; in theory; it should work for the 75 numbers.
Because each set depends on the same variables.?

Regards.

Hugh

billhsln

Simple answer:

90/10 = 9

colums = 10, y=1, 11, 21, 31, 41, 51, 61, 71, 81 (9 columns)

75/5 = 15

colums = 5, y=1, 6, 11, 16, 21, 26, 31, 36, 41, 46, 51, 56, 61, 66, 71 (15 columns)

change colums = 5 for number = 75, that will give you the 15 you are looking for.

Also, note that cc = 50 in both cases, which means you could just replace cc with a constant 50.

Bill
When all else fails, get a bigger hammer.

hugh

Thank you Bill,

My rows of numbers are; when (colums = 10 and rowes = 10

   1       2      3      4      5      6      7      8      9     10
   
  11     12     13    14    15    16     17    18    19    20

last row;

  81     82     83    84    85    86     87     88   89   90;

ie the code i have works perfectly for the above display,

Now i ; i changed one  thing and one  thing only in the   if number = 75
I changed (rowes) from [6]  to  [15] ; and left the colums the same , at 15,

with that i now have numbers from 1 to 15 in the first row
and continues down to the last row, with the last row of 15 numbers from 61 to 75
I am happy enough with that.

thanks for your help Bill

Regards

Hugh