Solved

Determining when resizing of window is done

Posted on 1998-08-17
9
332 Views
Last Modified: 2010-04-04
I have a window which is very processor-happy; meaning that is takes some time to redraw the window. I need to redraw it when the user changes the size. The problem is that I need to know when the user is done resizing the window,  since it is too slow to update it when the user drags the edges. How could this be done?

/Pede

0
Comment
Question by:pede
[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
  • 4
  • 3
  • 2
9 Comments
 
LVL 10

Expert Comment

by:viktornet
ID: 1336899
Ok, here is what you do...
{...}
private
    { Private declarations }
    procedure ENDSIZE(var Message : TMessage);message WM_EXITSIZEMOVE;
{...}
procedure TForm1.ENDSIZE(var Message : TMessage);
begin
  Inherited;
  FormPaint(self);
end;
procedure TForm1.FormPaint(Sender: TObject);
Var
  TmpX, TmpY : byte;
begin
   FOR TmpX := 0 TO 255 DO
     FOR TmpY := 0 TO 255 DO
       Canvas.Pixels[TmpX,TmpY] :=
         RGB(TmpX, 255 - TmpY, TmpY);
end;
procedure TForm1.FormResize(Sender: TObject);
begin
  FormPaint(Self);
end;

I haven't try this so you try it and see... I just looked up the message.

Regards,
Viktor Ivanov
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1336900
You can also play with this part->
procedure TForm1.ENDSIZE(var Message : TMessage);
begin
     Inherited;
     FormPaint(self);
end;
{You might try removing the Inherited, or Message.result := 0 or 1;and stuff like that}

Viktor Ivanov
0
 
LVL 1

Author Comment

by:pede
ID: 1336901
I have never heard of this message, unfortunately neither has Delphi. Was it a typo? I tried to search for messages like WM_ENDSIZEMOVE and so on, but I cant find any.
I use Delphi 1.0, but I tried both 1.0 and 3.0

/Pede

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!

 
LVL 10

Expert Comment

by:viktornet
ID: 1336902
Did you try it on, not just searching. I'm using Delphi 3. Delphi hasn't heard of it because you aren't searching in Delphi 3's Win32.hlp file that's why. Check it out again, and then tell me what's going on. Once again I'm asking you to try the project....

I didn't try it when I wrote the previous section, but I've tried it now and it works, so go and give it a shot.

Regards,
Viktor Ivanov
0
 
LVL 1

Author Comment

by:pede
ID: 1336903
I did try to compile (in Delphi 1.0). I replaced WM_ERASEBKGND in some of my code, with WM_EXITSIZEMOVE. Unknown identifier. I also just checked the list of Windows 3.1 messages in the Delphi API help. It's not there.
Any suggestions?

/Pede


 
0
 
LVL 3

Expert Comment

by:vladika
ID: 1336904
const
  WM_ENTERSIZEMOVE = $0231;
  WM_EXITSIZEMOVE = $0232;
  SPI_SETDRAGFULLWINDOWS = 37;
  SPI_GETDRAGFULLWINDOWS = 38;

type
  TForm1 = class(TForm)
  private
    { Private declarations }
    FDragFullWindows: LongBool;
    procedure WMEnterSizeMove(var Message: TMessage); message WM_ENTERSIZEMOVE;
    procedure WMExitSizeMove(var Message: TMessage); message WM_EXITSIZEMOVE;
  public
    { Public declarations }
  end;

procedure TForm1.WMEnterSizeMove(var Message: TMessage);
begin
  SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, @FDragFullWindows, 0);
  SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, 0, nil, 0);
end;

procedure TForm1.WMExitSizeMove(var Message: TMessage);
begin
  SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, Integer(FDragFullWindows), nil, 0);
end;


0
 
LVL 1

Author Comment

by:pede
ID: 1336905
This one helps :)
You need to propose an answer to get your points.
Why do you add the SystemParameterInfo... calls? It worsk just fine without them.

Thankst,

/Pede

0
 
LVL 3

Accepted Solution

by:
vladika earned 50 total points
ID: 1336906
SPI_GETDRAGFULLWINDOWS determines whether dragging of full windows is enabled.
SPI_SETDRAGFULLWINDOWS sets dragging of full windows either on or off.

I think if dragging of full windows is enabled (for example when you use Microsoft Plus!)
window will be repaint when you resize it.
So, at first I disable dragging of full windows
  // remember previous value of DragFullWindows parameter
  SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, @FDragFullWindows, 0);
  // disable DragFullWindows parameter
  SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, 0, nil, 0);

And at the end I restore DragFullWindows parameter
  SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, Integer(FDragFullWindows), nil, 0);

But question was how can I determine when the user is done resizing the window?
And answer is WM_EXITSIZEMOVE message.
So you can ignore SystemParametersInfo calls.

0
 
LVL 1

Author Comment

by:pede
ID: 1336907
:)     <--- This is me


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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

689 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