Solved

handle of scrollbar

Posted on 1998-06-18
7
443 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows Drag & Drop Location 2 94
Delphi 10 Seattle Dataset Actions 5 78
Delphi with SQL Natvie Client 15 85
Error E2158 compiling with Delphi XE10 Seattle 2 83
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 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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

914 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

13 Experts available now in Live!

Get 1:1 Help Now