Solved

TStringGrid's Selection Property (D2)

Posted on 1997-09-17
1
760 Views
Last Modified: 2008-02-26
I want to manually set the Selection property of a TStringGrid. Selection is of type TGridRect.
I have tried the following:

StringGrid1.Selection := Rect(1,1,5,5);

but get the error: "TGridRect and TRect not identical types"

so, is it possible to set a selection manually?
should be an easy one.
0
Comment
Question by:boabyte
1 Comment
 
LVL 3

Accepted Solution

by:
mirek071497 earned 50 total points
Comment Utility
Yes but function Rect return TRect not TGridRect.
TRect have integer values but TGridRect have longint values.

try this :

var MyRect : TGridRect;

begin
  MyRect.Left :=1;
  MyRect.Top:=1;
  MyRect.Right:= 5;
  MyRect.Bottom := 5;
  StringGrid1.Selection := MyRect;
end;
 
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
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…

763 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

10 Experts available now in Live!

Get 1:1 Help Now