Solved

handle of scrollbar

Posted on 1998-06-18
7
447 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
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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

 

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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

829 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