?
Solved

Move To StringGrid Component

Posted on 1997-05-25
2
Medium Priority
?
871 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 4

Accepted Solution

by:
erajoj earned 100 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

Industry Leaders: 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

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…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month11 days, 3 hours left to enroll

770 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