Is this a bug in the Grid Cell alignment?


Run the code below. It creates a grid with 2 rows and 2 columns. Move your cursor between rows and you see “some data” bouncing around”


Try it with the other IF condition to see the expected behavior. Is this a bug?


 


 


 


PUBLIC oForm


oForm=CREATEOBJECT(“MyForm”)


oForm.show


 


DEFINE CLASS MyForm as Form


          left=100


          height=200


          width=600


          allowoutput=.f.


          PROCEDURE init(cFilename)


                   IF .t.


                             CREATE CURSOR test (num i,name c(40))


                             INSERT INTO test VALUES (0,”name”)


                             INSERT INTO test VALUES (1,”name”)


                   ELSE


                             CREATE CURSOR test (num c(10),name c(40))


                             INSERT INTO test VALUES (“0″,”name”)


                             INSERT INTO test VALUES (“1″,”name”)


                   ENDIF


                   this.AddObject(“grd”,”grid”)


                   WITH this.grd as grid


                             .Visible=1


                             .Height=thisform.Height


                             .Width=thisform.Width


                             WITH this.grd.column1 as Column


                                      .header1.caption=”Name”


                                      .ControlSource=”‘some data         ‘”


                                      .Width=250


                             ENDWITH


                             LOCATE


                   ENDWITH


ENDDEFINE


 

Comments (1)

  1. Brian says:

    No .. I dont think so … I think this is a case of the Fox Developer (like you) insulating Fox programmers (like me) from very bad things should I forget to explicitly assign the controlsource of the grid or if the controlsource datatype changes ‘mid stream’.

    I think this has to do with

    The assumed data type associated with column 1.

    If you make bound=.t. for the cursor with all char data types all is well. But when bound =.t. where then ‘implied’ vartype(column1)="N" watch the data really jump around…..

    So this leads me to believe that this is in fact a Fox grid feature that prvents the Grid from ‘crapping out’ if controlsource is improperly assigned and the column datatype changes on the fly…

    Am I correct?