Solved

Want to scroll down TStringGrid: WM_MOUSEWHEEL message

Posted on 2003-12-02
2
810 Views
Last Modified: 2008-01-09
hi all,

I want to scroll automatically down in a TSTringGrid (borland cpp builder 6) when i add an item to the grid.  I haven't found yet how to do this.  I want that the latest added item is always visible and selected.
I tried to send a message to the stringgrid as if i would scoll on it with my mouse:

PostMessage((HWND)StringGrid1->Handle,WM_MOUSEWHEEL,1,1);

unfortunately this does not work.  Am i missing something?


Greetz
0
Comment
Question by:cleaverX
[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 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 50 total points
ID: 9858445
PostMessage((HWND)StringGrid1->Handle, WM_VSCROLL ,SB_BOTTOM , 0);    // SB_BOTTOM, SB_LINEDOWN etc. - select what you need
0
 
LVL 15

Expert Comment

by:efn
ID: 9858675
Another way:

      StringGrid1->TopRow = StringGrid1->RowCount - StringGrid1->VisibleRowCount;

You can control the selection with the Selection property.  For example:

      TGridRect tgr;
      tgr.Left = tgr.Right = 0;
      tgr.Top = tgr.Bottom = StringGrid1->RowCount - 1;
      StringGrid1->Selection = tgr;

--efn
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

Suggested Solutions

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

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