?
Solved

Want to scroll down TStringGrid: WM_MOUSEWHEEL message

Posted on 2003-12-02
2
Medium Priority
?
824 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 150 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

771 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