Solved

handle of scrollbar

Posted on 1998-06-18
7
442 Views
Last Modified: 2010-04-04
How do i find the handle of the (vertical) scrollbar in a TMemo / TRichedit control?
0
Comment
Question by:kyr
7 Comments
 
LVL 5

Expert Comment

by:ronit051397
Comment Utility
What exactly you need to do with the scroll?
0
 
LVL 3

Expert Comment

by:Matvey
Comment Utility
Hi

I don't know how to get it's handle and I'm not even sure there is such a thing as it's handle - TControlScrollBar has no this property.

If you want to assign it's parameters you can do it like this:

      SetScrollPos(Memo1.Handle, SB_HORZ, 50, True);

-50 is the position, etc...

Is this what you want to do? If not, please tell us what it is...

Regards, Matvey
0
 

Expert Comment

by:d_hobert
Comment Utility
tyr using this method...it worked for me when I was trying to get rid of the scroll bars on a tTablegrid  :

procedure TkcConfigForm.FormActivate(Sender: TObject);
var
   kcWorked,
   bgWorked      : boolean;
   kcHandle,
   bgHandle      :  Integer;

begin
  dataLand.kcConfigTbl.open;
  dataLand.kcConfigTbl.first;
  dataLand.badGuysTbl.open;

if not kcConfigGrid.HandleAllocated then
     kcConfigGrid.handleNeeded;
  if not badGuysGrid.HandleAllocated then
     badGuysGrid.handleNeeded;

  kcHandle := kcConfigGrid.handle;
  bgHandle := badGuysGrid.handle;
  kcWorked := showScrollBar(kcHandle,sb_both, false);
  if not kcworked then
     application.messageBox('couldn''t get rid of scroll bars','didn''t work', mb_ok) ;


showScrollBar is an api function that you can look up to see how to show or hide the different scroll bars
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:kyr
Comment Utility
d_hobert: your function disables scrollbars based on the handle of the control. well, i already know the handle of my TMemo.

all: what i actually want to do is to move the scroll bar to its lowest position
this works
SendMessage(reLog.Handle, EM_SCROLL, SB_LINEUP, 0);
but can only move page down/up line down/up

Another reason i want the handle is to set its tracking property to true in a dbgrid, so that i can view records while i am scrolling before the thumb tab is released.



0
 
LVL 3

Accepted Solution

by:
vladika earned 100 total points
Comment Utility
Try

1)move the memo scroll bar to its lowest position
  SendMessage(Memo.Handle, EM_LINESCROLL, 0, Memo.Lines.Count);

2)scrolling before the thumb tab is released
create new component and test it

interface

type
  TDBThumbTrackGrid = class(TDBGrid)
  private
    procedure WMVScroll(var Message: TWMVScroll); message WM_VScroll;
  end;

implementation

procedure TDBThumbTrackGrid.WMVScroll(var Message: TWMVScroll);
begin
  if not FAcquireFocus then Exit;
  if Datalink.Active then
  begin
    with Message, DataLink.DataSet do
    begin
      if ScrollCode = SB_THUMBTRACK then
      begin
        if IsSequenced then
        begin
          if Pos <= 1 then First
          else if Pos >= RecordCount then Last
          else RecNo := Pos;
        end
      end else inherited;
    end;
  end;
end;

But scrolling work only for Paradox :-(
(trouble is IsSequenced)

0
 
LVL 3

Expert Comment

by:Matvey
Comment Utility
Kyr, if you look at my comment, that was the first one in the list, you see the exact answere!!!
0
 

Author Comment

by:kyr
Comment Utility
Dear matvey,
  I tried your idea in a listview component but it just moves the thumb tab of the scroll bar, nothing more. It does not update the contents of the window.

Dear vladika,
  I will accept part (a) but not (b)
I found another solution that is available to anyone (send me an email message). The idea was given to me from a delphi mailing lists. It just fools the control by sending a SB_THUMBTRACK code parameter instead of a SB_THUMBPOSITION (which does not work the way i want it to).

Thanx a lot anyway to all
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

743 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

17 Experts available now in Live!

Get 1:1 Help Now