Determining when resizing of window is done

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

LVL 1
pedeAsked:
Who is Participating?
 
vladikaConnect With a Mentor Commented:
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
 
viktornetCommented:
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
 
viktornetCommented:
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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
pedeAuthor Commented:
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
 
viktornetCommented:
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
 
pedeAuthor Commented:
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
 
vladikaCommented:
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
 
pedeAuthor Commented:
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
 
pedeAuthor Commented:
:)     <--- This is me


0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.