|
Post by metro on Mar 12, 2019 5:43:43 GMT -5
Can someone shed some light on whether this is possible I'm trying to use a variable for rownames thanks in advance
WindowWidth=500 WindowHeight=350 Rownames$="" for n=1 to 5 Rownames$=Rownames$+","+str$(n) next
lenR=len(Rownames$) Rownames$=right$(Rownames$,lenR-1) print Rownames$
dim a$(4, 2) grid #w.grid, a$(), [clicked], 10, 10, 450, 300 for x = 0 to 4 for y = 0 to 2 a$(x,y) = "c"+str$(x)+" r"+str$(y) a$(0,y)="ACD" next y next x
open "Grid test" for window as #w #w.grid columnnames("Modify","lock", "stock", "barrell", "powder") #w.grid columnwidths(50) #w.grid rownames("+Rownames$+") #w.grid rowlabelwidth(80) #w.grid selectxy(2, 2) ' print #w.grid value$() ' #w.grid setvalue("yahoo") ' print #w.grid value$() ' print #w.grid debug$() wait [clicked] ' print "clicked: "; #w.grid cellxy$() r$=#w.grid cellxy$() if left$(r$,1)="1" then print"all Values" rw$= right$(r$,1) y=val(rw$) for x= 1 to 4 #w.grid selectxy(x+1,y) print #w.grid value$() next x end if wait
|
|
|
Post by meerkat on Mar 12, 2019 5:59:36 GMT -5
I hate to say this.. But take a look at the grid test program that initially started all the lock stuff. The grid is generated based on what table you select from a DB. Basically you have to do a eval. here is some of the code from that program..
a = eval("#w.grid columnnames("+cn$+")") ' put column names on the grid '
cma$ = "" rn$ = "" ' row names for grid for i = 1 to numRows ' set length of colNames and center then rn$ = rn$ + cma$ + q$ + "Rec_" + right$("00" + str$(i),2) + q$ cma$ = "," next i
a = eval("#w.grid rownames("+rn$+")") 'label the rows #w.grid rowlabelwidth(40) 'set sizes for rows
Hope that helps..
|
|
|
Post by metro on Mar 12, 2019 6:05:43 GMT -5
Thanks Dan, big help once again, just changed one line I need to read up on eval
a = eval("#w.grid rownames("+Rownames$+")") 'label the rows
|
|