?
Solved

handle of scrollbar

Posted on 1998-06-18
7
Medium Priority
?
451 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
[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
7 Comments
 
LVL 5

Expert Comment

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

Expert Comment

by:Matvey
ID: 1353690
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
ID: 1353691
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:kyr
ID: 1353692
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 200 total points
ID: 1353693
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
ID: 1353694
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
ID: 1353695
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

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

741 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