Solved

ScrollWindowEx

Posted on 1997-07-24
6
1,159 Views
Last Modified: 2010-07-27
Whats the EXACT syntax for using this win api call?
0
Comment
Question by:sz3905
[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
  • 3
  • 3
6 Comments
 
LVL 4

Expert Comment

by:erajoj
ID: 1339736
The EXACT syntax is this:

  function ScrollWindowEx(
    hWnd      : HWND;    // handle of window to scroll
    dx,                  // amount of horizontal scrolling
    dy        : Integer; // amount of vertical scrolling
    prcScroll,           // address of scroll rectangle
    prcClip   : PRect;   // address of clip rectangle
    hrgnUpdate: HRGN;    // handle of update region
    prcUpdate : PRect;   // address of update rectangle
    flags     : UINT     // scrolling flags
  ): BOOL; stdcall;

Read the help for further info on the parameters.

And this is an example of how simple it is to use it:

  ScrollWindowEx(
    Handle,      // Handle of window to scroll
    10,              // Amount of horizontal scrolling
    10,              // Amount of vertical scrolling
    nil,      // Scroll whole window
    nil,        // No clipping necessary
    0,              // Don't need it
    nil,        // Don't need it
    SW_ERASE    // Erase background to clBtnFace in this case
   );

Hope this is what you asked for.

/// John

0
 

Author Comment

by:sz3905
ID: 1339737
John I'm sorry, I was looking for an exact useable syntax. More like a simple working example of a scrolling rectangle, but with the complete prect structure vars and declarations. The sample you gave is like the books(which never have a working sample).    thx for a reply/steve
0
 
LVL 4

Expert Comment

by:erajoj
ID: 1339738
Have you tried it?
My example works fine.
I never send examples unless I have tested them.
What didn't work or what do you miss?

/// John

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:sz3905
ID: 1339739
I'm sure your sample works, your suggestion "Read the help for further info on the parameters" is where I'm having the problem.
The help doesn't give a working "procedure" sample that addresses the exact syntax for coding "prcScroll, prcClip, prcUpdate, hrgnUpdate" and I dont want to use "nil". If this is still unclear please state whats not clear.
John, thanks for being so quick in you response./steve

0
 
LVL 4

Accepted Solution

by:
erajoj earned 120 total points
ID: 1339740
This will probably look crappy since Experts-Exchange uses
proportional fonts :-( but I think you'll get the idea:

procedure TfrmMain.Button4Click(Sender: TObject);
var
  ScrollRect, ClipRect, UpdateRect: TRect;
  RGN: HRGN;
begin
  ScrollRect := Rect(50, 50, 150, 150);
  ClipRect   := Rect(50, 50, 150, 150);

   //  __________
   // |          |
   // |          |
   // |          |
   // |          |
   // |          |
   // |          |
   // |__________|
   // ^
   // ClipRect & ScrollRect

  ScrollWindowEx(
    Handle,                // Handle of window to scroll
    10,                    // Amount of horizontal scrolling
    10,                    // Amount of vertical scrolling
    @ScrollRect,          // Scroll whole window
    @ClipRect,        // No clipping necessary
    RGN,                  // Region returned
    @UpdateRect,      // Region boundaries
    SW_SCROLLCHILDREN      // This will move the children affected!
   );

   //  __________
   // |##########|
   // |## _______|
   // |##|       |  ## = RGN;
   // |##|       |
   // |##|       |
   // |##|       |
   // |__|_______|
   // ^  ^
   // |  ScrollRect
   // ClipRect & UpdateRect (in this case)


  ScrollRect := Rect(50, 50, 150, 150);
  ClipRect   := Rect(50, 50, 150, 150);

   //  __________
   // |          |
   // |          |
   // |          |
   // |          |
   // |          |
   // |          |
   // |__________|
   // ^
   // ClipRect & ScrollRect

  ScrollWindowEx(
    Handle,                // Handle of window to scroll
    10,                    // Amount of horizontal scrolling
    0,                    // Amount of vertical scrolling
    @ScrollRect,          // Scroll whole window
    @ClipRect,        // No clipping necessary
    RGN,                  // Region returned
    @UpdateRect,      // Region boundaries
    SW_SCROLLCHILDREN      // This will move the children affected!
   );

   //  __________
   // |##|       |
   // |##|       |
   // |##|       |  ## = UpdateRect + RGN;
   // |##|       |
   // |##|       |
   // |##|       |
   // |__|_______|
   // ^  ^
   // |  ScrollRect
   // ClipRect

end;

Now then, or am I a really stupid person, not understanding
what you need to know?

/// John

0
 

Author Comment

by:sz3905
ID: 1339741
you said "Now then, or am I a really stupid person, not understanding what you need to know? "
---------------------------------
No John, you answered perfectly!
thx/steve
0

Featured Post

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.

Question has a verified solution.

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

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…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
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.
Suggested Courses
Course of the Month7 days, 5 hours left to enroll

622 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