IWAppFormAsyncResize fired without reason

<< Click to Display Table of Contents >>

Navigation:  Forum >

IWAppFormAsyncResize fired without reason

Forum link

 


 

02-14-2023, 10:10 AM:

 

Hello!

 

Discovered another strange ting in IntraWeb 15.2.69.

 

Try the following:

 

Create a new IW application and put a TIWTabControl on it.

 

Add a couple of pages to the TabControl.

 

Create an event for the forms OnAsynchResize.

 

When running the application the OnAsynchResize is fired once as it should and you can switch between the pages on the TabControl and no more OnAsynchResize is fired.

 

Now add an event to the TabControls OnChange event, it can be an empty event doing nothing.

 

Now when you run the program the OnAsynchResize event is fired on program startup as it should, but it's also fired every time you change page in the page control!

 

This is a big issue for me as I use the OnAsynchResize event for rescaling every component on the form.

 

Am i missing soething here? Is this normal behaviour?

 

Best regards, Mikael

 

object IWForm2: TIWForm2

 

  Left = 0

 

  Top = 0

 

  Width = 555

 

  Height = 400

 

  RenderInvisibleControls = True

 

  AllowPageAccess = True

 

  ConnectionMode = cmAny

 

  OnAsyncResize = IWAppFormAsyncResize

 

  Background.Fixed = False

 

  HandleTabs = False

 

  LeftToRight = True

 

  LockUntilLoaded = True

 

  LockOnSubmit = True

 

  ShowHint = True

 

  DesignLeft = 3

 

  DesignTop = 3

 

  object IWTabControl1: TIWTabControl

 

    Left = 96

 

    Top = 72

 

    Width = 305

 

    Height = 225

 

    RenderInvisibleControls = True

 

    OnChange = IWTabControl1Change

 

    ActiveTabFont.Color = clWebWHITE

 

    ActiveTabFont.FontFamily = 'Arial, Sans-Serif, Verdana'

 

    ActiveTabFont.Size = 10

 

    ActiveTabFont.Style = [fsBold]

 

    ActiveTabFont.PxSize = 13

 

    InactiveTabFont.Color = clWebBLACK

 

    InactiveTabFont.FontFamily = 'Arial, Sans-Serif, Verdana'

 

    InactiveTabFont.Size = 10

 

    InactiveTabFont.Style = []

 

    InactiveTabFont.PxSize = 13

 

    ActiveTabColor = clWebDARKGRAY

 

    InactiveTabColor = clWebLIGHTGRAY

 

    ActivePage = 0

 

    BorderOptions.NumericWidth = 0

 

    BorderOptions.Style = cbsNone

 

    Color = clWebSILVER

 

    ClipRegion = False

 

    TabPadding = 0

 

    ActiveTabBorder.Color = clWebBLACK

 

    ActiveTabBorder.Width = 0

 

    InactiveTabBorder.Color = clWebBLACK

 

    InactiveTabBorder.Width = 0

 

    DesignSize = (

 

      305

 

      225)

 

    object IWTabControl1Page0: TIWTabPage

 

      Left = 0

 

      Top = 20

 

      Width = 305

 

      Height = 205

 

      RenderInvisibleControls = True

 

      Title = 'Page0'

 

      BorderOptions.NumericWidth = 0

 

      BorderOptions.Style = cbsNone

 

      Color = clWebWHITE

 

    end

 

    object IWTabControl1Page1: TIWTabPage

 

      Left = 0

 

      Top = 20

 

      Width = 305

 

      Height = 205

 

      RenderInvisibleControls = True

 

      TabOrder = 1

 

      Title = 'Page1'

 

      BorderOptions.NumericWidth = 0

 

      BorderOptions.Style = cbsNone

 

      Color = clWebWHITE

 

    end

 

  end

 

end

 

 

 

unit Unit2;

 

interface

 

uses

 

  Classes, SysUtils, IWAppForm, IWApplication, IWColor, IWTypes,

 

  IWCompTabControl, Vcl.Controls, Vcl.Forms, IWVCLBaseContainer, IWContainer,

 

  IWHTMLContainer, IWHTML40Container, IWRegion;

 

type

 

  TIWForm2 = class(TIWAppForm)

 

    IWTabControl1: TIWTabControl;

 

    IWTabControl1Page0: TIWTabPage;

 

    IWTabControl1Page1: TIWTabPage;

 

    procedure IWAppFormAsyncResize(Sender: TObject; EventParams: TStringList);

 

    procedure IWTabControl1Change(Sender: TObject);

 

  public

 

  end;

 

implementation

 

{$R *.dfm}

 

procedure TIWForm2.IWAppFormAsyncResize(Sender: TObject; EventParams: TStringList);

 

begin

 

// Put breakpoint here if you want to see when it's fired

 

end;

 

// If this function is removed everything works fine!

 

procedure TIWForm2.IWTabControl1Change(Sender: TObject);   

 

begin

 

//

 

end;

 

initialization

 

  TIWForm2.SetAsMainForm;

 

end.

 

 

 


 

02-15-2023, 10:57 PM:

 

The OnChange event of the PageControl triggers a full postback and the page is re-rendered, which means that it will trigger a new OnAsyncResize event (which happens every time a page is rendered). This is normal an expected.

 

I would suggest for you to try the new IWjQPageControl instead of the IWTabControl component, however it doesn't contain an AsyncChange event. It's in our todo list but not ready yet.

 


 

02-21-2023, 07:48 AM:

 

Hello!

 

Ok, thanks. Then I think the OnAsynchResize has a very strange name :-) OnRenderComplete would have been much better.

 

When starting with IntraWeb this sort of proplems take ages to figure out. Is there some kind of documentation where all these behaviours are documented?

 

I tried the IWjQPageControl but it's missing the Align property!?

 

I also tried to create a page in the IWjQPageControl and put a IWRegion aligned to client in it. The problem now is that when the IWjQPageControl the IWRegion does not update it's size correctly!?

 

 

 

Best regards, Mikael