Solved

Want to scroll down TStringGrid: WM_MOUSEWHEEL message

Posted on 2003-12-02
2
793 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
2 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 50 total points
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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. …
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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 be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

772 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

10 Experts available now in Live!

Get 1:1 Help Now