Solved

Determining when resizing of window is done

Posted on 1998-08-17
9
324 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
 
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now