Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Want to scroll down TStringGrid: WM_MOUSEWHEEL message

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

618 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