Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Form resizing
Hi Jose,

Sorry for the long delay. I tried to apply your proposal, but it was not possible. I forgot to mention it's a TMS IWAdvWebGrid I'm using. Not a DBAware, just plain one.

Been trying to find a solution since and have finally arrived at a acceptable one:

It turns out the grid is only adjusted after a round-trip to the server, but also that the FormAsyncResize event is called, not only when the form is resized, but also after every non-async event. Knowing that I have done like this:

Added two integers on form level, called CurrentHeight and CurrentWidth. In FormCreate I set them to the Height and Width of the form.
Added a integer on form level, called FirstTime. In FormCreate I set it to -1.

Added an IWButton, set it's visible property to false, and added an OnClick event, but with no codelines except for a comment (to avoid it being removed at next save)

Added an IWTimer, set the interval to 10 ms and set enabled to false, and added an OnIWTimer event with two lines of code:
IWTimer.enabled := false;

Added a FormAsyncResize event with the following code:
If FirstTime <> 0 then
  CurrentWidth := self.Width;
  CurrentHeight := self.Height;
  FirstTime := 0;
If (self.Width <> CurrentWidth) or
  (self.Height <> CurrentHieght) then
  IWTimer1.enabled := true;
  CurrentWidth := self.Width;
  CurrentHeight := self.Height;

That way the grid size (and other components reacting to form resize) is only adjusted when the form size is actually changed and not also everytime a non-Async OnClick event is fired. And in my case, because I set a user defined font size and - family name as a general function of any form, which will change the size compared to the designed one, the FirstTime also preventes the resize to executed when the form is created at first.


Messages In This Thread
Form resizing - by SorenJensen - 12-06-2019, 08:40 AM
RE: Form resizing - by Jose Nilton Pace - 12-06-2019, 12:26 PM
RE: Form resizing - by SorenJensen - 12-11-2019, 11:32 AM
RE: Form resizing - by SorenJensen - 12-18-2019, 05:02 PM
RE: Form resizing - by Alexandre Machado - 12-28-2019, 04:06 PM
RE: Form resizing - by SorenJensen - 12-31-2019, 09:58 AM

Forum Jump:

Users browsing this thread: 1 Guest(s)