Solved

ScrollWindowEx

Posted on 1997-07-24
6
1,133 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
Technology Partners: 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: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

Independent Software Vendors: 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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
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…

749 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