Solved

Determining when resizing of window is done

Posted on 1998-08-17
9
330 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
  • 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Suggested Solutions

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…
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

809 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