Board index » cppbuilder » TDrawGrid problem

TDrawGrid problem


2004-01-04 01:42:19 AM
cppbuilder83
I am using a TDrawGrid. I use OnDrawCell to draw the values of text in
each cell, and SetEditText to capture the values entered.
When I create a new row (RowCount++) and initialize the values it looks
fine. But when I edit a value, it shows twice - one from the TextOut,
and one from the editor (I guess!).
I tried using GetEditText instead of OnDrawCell to show the initial
values, but then the initial values don't show until I click on the cells.
I don't get it! Please set me straight...
Hugh Stewart
 
 

Re:TDrawGrid problem

"Hugh W Stewart" < XXXX@XXXXX.COM >wrote in message
Quote
I am using a TDrawGrid. I use OnDrawCell to draw the values of text in
each cell, and SetEditText to capture the values entered.

When I create a new row (RowCount++) and initialize the values it looks
fine. But when I edit a value, it shows twice - one from the TextOut,
and one from the editor (I guess!).
It is better to use TextRect() to draw the text in each cell rather than
TextOut
//---------------------------------------------------------
// Draw the Text in each Cell
//---------------------------------------------------------
Canvas->FillRect(Rect);
Canvas->TextRect(Rect, Rect.Left + 10, Rect.Top + 2, Cells[Col][Row]);
Quote
I tried using GetEditText instead of OnDrawCell to show the initial
values, but then the initial values don't show until I click on the cells.

I don't get it! Please set me straight...
Have a look at sgGetEditText in the following link to see if this solves
your problem
www.geocities.com/rodolfofrino/MicroStringGrid.html
Rodolfo
 

Re:TDrawGrid problem

"Hugh W Stewart" < XXXX@XXXXX.COM >wrote in message
Quote
I am using a TDrawGrid. I use OnDrawCell to draw the values
of text in each cell, and SetEditText to capture the values entered.
Since you are displaying text, why not use TStringGrid instead of TDrawGrid?
Quote
But when I edit a value, it shows twice - one from the TextOut,
and one from the editor (I guess!).
The editor is a separate window, it does not draw onto the grid at all. The
edit field covers the entire cell that is being edited, so you should not be
seeing any drawing for that cell at all.
Gambit
 

{smallsort}