Solved

handle of scrollbar

Posted on 1998-06-18
7
449 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
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!

 

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 100 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying 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

Suggested Solutions

Title # Comments Views Activity
Error E2158 compiling with Delphi XE10 Seattle 2 138
Firemonkey Queue list 1 51
Broadcast a message using ICS 2 50
TAction.OnAfterExecute? 2 31
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

737 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