Solved

Move To StringGrid Component

Posted on 1997-05-25
2
843 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

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

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
ADO Memory leak with DELPHI 2007 37 155
Mydac connection data base issue 3 106
code issue 8 84
Delphi IDE crash without error message ... 7 59
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

708 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

14 Experts available now in Live!

Get 1:1 Help Now