I meet a problem on making a StringGrid which is enabled/disabled under different circumstance. Initially it should be disabled(I made it enabled in object inspector, but initialed it by some code). However, when I run the program, I found the upper-left-coner cell can be edited if I type character immediately. If I select another cell, it will not be editable, then if I go back to upper-left-coner cell, it becomes not editable.
After kicking around with the program, I guessed that's because when the Grid was create, the upper-left-coner was automatically selected, and the value "True" of goAlwaysShowEditor option make the upper-left-coner cell editable, even at that time the Grid was disabled.
Then I gave a "False" to goAlwaysShowEditor in object inspected, and only add it to Options by code whenever user need to input data by Grid. It seems works well to pervent user from typing characters in at the unexpected time.
The problem seems solved, but I just post it to see if there is any related ideas or better solutions.
0 · ·