mikepj
asked on
Memo field in DBGrid or StringGrid?
Hi,
I need to put a memo of some kind in a grid so that you can edit the memo field in the grid (Delphi 4). I know that components like InfoPower are the best way to do this but is there another way?
Thank you,
/MP
I need to put a memo of some kind in a grid so that you can edit the memo field in the grid (Delphi 4). I know that components like InfoPower are the best way to do this but is there another way?
Thank you,
/MP
Here is what you do:-)
In the OnDrawCell() of the string grid....
---------
procedure TForm1.SGDrawCell(Sender: TObject; Col, Row: Integer;
Rect: TRect; State: TGridDrawState);
begin
if(col = 1)and(row = 1) then
with Memo1 do
begin
Parent := SG;
Left := Rect.Left;
Top := Rect.Top;
Width := Rect.Right div 2;
Height := Rect.Bottom div 2;
end;
end;
-----------
Regards,
Viktor Ivanov
In the OnDrawCell() of the string grid....
---------
procedure TForm1.SGDrawCell(Sender: TObject; Col, Row: Integer;
Rect: TRect; State: TGridDrawState);
begin
if(col = 1)and(row = 1) then
with Memo1 do
begin
Parent := SG;
Left := Rect.Left;
Top := Rect.Top;
Width := Rect.Right div 2;
Height := Rect.Bottom div 2;
end;
end;
-----------
Regards,
Viktor Ivanov
ASKER
Thank you for your reply,
Although on the surface, this answer does work, there are a number of problems which come up when I do this. Things like:
- problems with focus control
- making it clear to the user what's happening
- dealing with times when it is not the top row item that is being edited
I am hoping to have a component that does this in a nice way rather than something that is kind of a mess.
/MP
Although on the surface, this answer does work, there are a number of problems which come up when I do this. Things like:
- problems with focus control
- making it clear to the user what's happening
- dealing with times when it is not the top row item that is being edited
I am hoping to have a component that does this in a nice way rather than something that is kind of a mess.
/MP
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for your answer. This doesn't solve my main problem per se but did provide a useful bit of information. I ended up doing a bit of a crazy solution to the problem using a memo which becomes visible superimposed over the grid when the memo field is entered.
1) when the user enters the field a membo box pops up and then goes away on field's loss on focus
2) for the user to be able to type and view memo data from the grid. If this is what you want do you want the boxes of the other fields to expand with the memo field's box or do you want the memo filed to wrap around the record or something like that?