Solved

Stringgrid read only column

Posted on 2000-03-28
6
2,006 Views
Last Modified: 2012-06-21
Is there a way to set a column in a stringgrid to read only and not allow it to be selected?
0
Comment
Question by:brettawv
  • 3
  • 2
6 Comments
 
LVL 2

Accepted Solution

by:
aubs earned 50 total points
ID: 2664378
Look at the OnSelectCell Event for the grid:

procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,
  ARow: Integer; var CanSelect: Boolean);
begin
      if Acol=2 then CanSelect:= False;
end;
0
 
LVL 17

Expert Comment

by:inthe
ID: 2664386
hi,
sure you can do this:

procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,
  ARow: Integer; var CanSelect: Boolean);
begin
// if column 2 is our read only column
if (acol = 2)  then canselect := false;
end;

Regards Barry
0
 
LVL 17

Expert Comment

by:inthe
ID: 2664388
:-)) too slow.
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 2

Expert Comment

by:aubs
ID: 2664451
Hi Barry

:-)
0
 

Author Comment

by:brettawv
ID: 2665733
Thanks.  I still need to know how to set focus to a different a cell. Can you help?
0
 
LVL 2

Expert Comment

by:aubs
ID: 2668679
You could try using the stringrid.selection property.

Regards
Aubs
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now