bad property on stringgrid

In this category you can exchange your programming questions and solutions.
Post Reply
PaPi
Posts: 114
Joined: Wed May 16, 2007 11:55 am

bad property on stringgrid

Post: # 651Post PaPi
Mon Jun 21, 2010 5:34 pm

There are an error with text property of stringgrid
(old version, fnxbasic03.zip)
See the program:

`stringgrid2_test  by PaPi  28.02.2010
object myform as form
     autosize=true
     onactivate=main
     object SG as stringgrid
           colcount=4
           rowcount=8
           height=220
           width=280
     end object ` SG
end object ` myform
myform.ShowModal

`------------------------------------------------------
sub Main()
     dim i as integer, j as integer
     for i=0 to SG.colcount
           for j=0 to SG.rowcount
                 SG.cell(i,j)=str$(i)+str$(j)
           next j
     next i
     showmessage SG.text ` Bad result on the last row (when j=8)
end sub ` Main

Note:
17 not equal 18   :-)

best wishes
PaPi

Marco
Site Admin
Posts: 246
Joined: Sat Sep 15, 2018 8:41 pm

bad property on stringgrid

Post: # 652Post Marco
Mon Jun 21, 2010 8:02 pm

hi
I think that the problem is the rowcount and colcount
colcount and rowcount includes the zero`s so it must be
for x= 0 to colcount-1
next
for y=0 to rowcount -1
next
Or you must declare a col or row more a colcount of 8 is 0 to 7 , 8 is not declared and gives a bad result.
I hope this will help
best regards marco

PaPi
Posts: 114
Joined: Wed May 16, 2007 11:55 am

bad property on stringgrid

Post: # 653Post PaPi
Tue Jun 22, 2010 2:24 pm

Hi Marco,
thanks, rowcount-1 as max,  and colcount-1 as max: it is good.
But, sorry, there are an error with rowcount when program compiled with old fnxcompiler version, and, there are NOT this error with new fnxcompiler version.
best regards
PaPi

ps: I use the old version rather as new, as the new haven`t good fnxeditor GUI...

Marco
Site Admin
Posts: 246
Joined: Sat Sep 15, 2018 8:41 pm

bad property on stringgrid

Post: # 654Post Marco
Tue Jun 22, 2010 3:02 pm

I`m still working at the new editor, update will come soon.
best regards

Post Reply