Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Resizing a form

Posted on 2004-08-16
10
Medium Priority
?
298 Views
Last Modified: 2010-04-05
I want to execute the code that is executed if my form is resized without resizing it. Hence a better title would be "Resizing a form without changing width and height". Maybe I can send a message?

TIA
0
Comment
Question by:__alex
[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
10 Comments
 
LVL 11

Expert Comment

by:calinutz
ID: 11807538
Which sizes do you  mean the? if not width and height?
Anyways the form event you are looking might be onResize or onCanResize.
If I understood your problem corectly.

0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 11807564
write you code in OnResize event of the form, but remove the line with inherited;
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 11807608
procedure TForm1.FormResize(Sender: TObject);
begin
  with Self.Constraints do
    begin
      MinHeight := Height;
      MaxHeight := Height;
      MinWidth  := Width;
      MaxWidth  := Width;
    end;
  // you code below
  Label1.Caption := 'Hello World!';
end;
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 2

Author Comment

by:__alex
ID: 11807621
I meant the code deep inside the VCL. I don't want to add any events.

> write you code in OnResize event of the form, but remove the line with inherited;
???
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 11807633
sorry, it was a mistake. I was thinking of something else...
0
 
LVL 7

Expert Comment

by:DavidBirch2dotCom
ID: 11807719
why not using something like

procedure TForm1.FormResize(Sender: TObject);
begin
   ShowMessage('BOO');
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
   FormResize(Sender);
end;

that will call the code in FormREsize, alternitvly you could create a your own procedure with the code from the resize procedire and then call that:

procedure TForm1.FormResize(Sender: TObject);
begin
   myprocedure;
end;

procedure TForm1.myprocedure;
Begin
   ShowMessage('BOO');
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
   myprocedure;
end;

which would avoid having to bother sending a 'Sender' varible to it

David
0
 
LVL 2

Author Comment

by:__alex
ID: 11807819
DavidBirch2dotCom ,
since I don't add any events to my form the OnFormResize property is Nil.

I don't have the source of the code I want to execute. It's not in my form but somewhere in TForm, TWinControl or whatever. Sorry for these ambiguities...
0
 
LVL 2

Accepted Solution

by:
DarkCore_ earned 800 total points
ID: 11808488
try to send the message WM_SIZE using

   MyForm.Perform( WM_SIZE, 0, 0 )
 
or
 
   SendMessage( MyForm.Handle, WM_SIZE, 0, 0 )

Edy
0
 
LVL 3

Expert Comment

by:lmikle
ID: 11808492
Try to send a WM_SIZE message to the form.

procedure TForm1.Button1Click(Sender : TObject);
begin
  Self.Perform(WM_SIZE,SIZE_RESTORED,(WORD(Self.Height) Shl 16) Or WORD(Self.Width));
end;
0
 
LVL 2

Author Comment

by:__alex
ID: 11809017
Got it... Thanks!
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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

722 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