Solved

Determining when resizing of window is done

Posted on 1998-08-17
9
327 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

770 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