Solved

Move To StringGrid Component

Posted on 1997-05-25
2
864 Views
Last Modified: 2008-03-17
Hello,
my name is Angel, and I'm from Barcelona,Spain. I'm sorry but my Englishis not to good that I wish.
I'm working with Delphi 2 in a project. The problem I've is working with StringGrid component.
For example, when the StringGrid shows on the screen, appears 20 elements and a horizontal scroll bar. There are 100 columns and one row. I would like that someone could help me and said me how I can move or go inmediately
to one specified columns in the grid (for example when I press a button I would like that inmediately the grid move to this position and this colums was displayed and marked in the Grid, only one position). At the moment, I'm not found anything propertis or methods to do this.

A lot of thanks for your time.

My e-mail is sa328@blues.uab.es
0
Comment
Question by:Anglaf
  • 2
2 Comments
 
LVL 4

Accepted Solution

by:
erajoj earned 50 total points
ID: 1336578
¡Hola!
It's in the help. You just have to find it.
If you want to show, for instance, column 50 then just do
like this:
    .
    .
  with MyGrid do begin
    Col     := 50;
    LeftRow := Col-(VisibleColCount div 2);
  end;
    .
    .

Almost the same goes for rows:
    .
    .
  with MyGrid do begin
    Row    := 50;
    TopRow := Row-(VisibleRowCount div 2);
  end;
    .
    .

This will show the selected row/col in the middle of the
TStringGrid. You can, ofcourse, combine the two.

Hope this helps!

/// John

0
 
LVL 4

Expert Comment

by:erajoj
ID: 1336579
Sorry!
A typing error in the answer will render it useless.
It should be like this:
    .
    .
with MyGrid do begin
  Col     := 50;
  LeftCol := Col-(VisibleColCount div 2); // < LeftCol fix
end;

Excuse any inconvenience!

// John

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

726 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