Give focus to a fixed cell in TStringGrid

I have a StringGrid which shows a popup menu when a cell in a fixed column is selected (right-clicked).  I want the selected cell to show it has focus somehow.  I've tried doing a FocusRect on the cell, changing the text in the cell to bold, and changing the color of the cell - none of which seem to work.  I've also tried turning defaultdrawing off and drawing the fixed cells myself, and then giving the selected fixed cell focus, but that also didn't work.  How can I show that the fixed cell has focus when selected?
jpozAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

intheCommented:
see if this will help
(default drawing off)



procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
var
 checked: boolean;
 oldbrush: integer;
 oldpen: tpen;
begin
 with stringgrid1.canvas,rect do
 begin
  oldbrush:=brush.color;
  brush.color:=clyellow;
  oldpen:=pen;
  pen.Width:=2;
  pen.color:=clred;
  moveto(left+1,top+2);
  polygon([point(left,top),
           point(left,bottom),
           point(right,bottom),
           point(right,top),
           point(left,top)]);
  checked:=boolean(stringgrid1.Objects[acol,arow]);
  if checked then
  begin
  brush.Color := clblue;
  polygon([point(left,top),
           point(left,bottom),
           point(right,bottom),
           point(right,top),
           point(left,top)]);
  end;
  brush.color:=oldbrush;
  textout(left+17,top+4,stringgrid1.cells[acol,arow]);
  pen:=oldpen;
 end;
end;

procedure TForm1.StringGrid1MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
 r,c: integer;
 checked: boolean;
begin
 with stringgrid1 do
 begin
  mousetocell(x,y,c,r);
  checked:=(longint(objects[c,r])<>0);
  if checked then objects[c,r]:=pointer(0) else objects[c,r]:=pointer(1);
 end;
 end;

 

Regards Barry
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jpozAuthor Commented:
I had to tweak it a little to work for my app, but it worked, thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.