Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Force update of an TIWTabControl from Asynch event
#1
Hello!

From an Asynch event I want to update the Title of a TIWTabControPage belonging to a TIWTabControl. 
When changing the Title the screen is not updated!?

How can I force the TIWTabControl to Refresh?

It works if I do a Self.AsyncReload(False) but is this the best way to do it?

Best regards, Mikael




unit Unit1;
Interface
uses
  Classes, SysUtils, IWAppForm, IWApplication, IWColor, IWTypes, Vcl.Graphics,
  IWVCLBaseControl, IWBaseControl, IWBaseHTMLControl, IWControl, IWCompExtCtrls,
  IWDrawButtonUnit, IWCompTabControl, Vcl.Controls, Vcl.Forms,
  IWVCLBaseContainer, IWContainer, IWHTMLContainer, IWHTML40Container, IWRegion,
  IWCompButton;
type
  TIWForm1 = class(TIWAppForm)
    IWTabControl1: TIWTabControl;
    IWTabControl1Page0: TIWTabPage;
    IWTabControl1Page1: TIWTabPage;
    IWTabControl1Page2: TIWTabPage;
    IWButton1: TIWButton;
    procedure IWButton1AsyncClick(Sender: TObject; EventParams: TStringList);
  public
  end;
implementation
{$R *.dfm}
procedure TIWForm1.IWButton1AsyncClick(Sender: TObject; EventParams: TStringList);
begin
  IWTabControl1Page0.Title := formatDateTime('hh:nnConfuseds', Now);
  // Self.AsyncReload(False); // Works
end;
initialization
  TIWForm1.SetAsMainForm;
end.




object IWForm1: TIWForm1
  Left = 0
  Top = 0
  Width = 1130
  Height = 914
  RenderInvisibleControls = True
  AllowPageAccess = True
  ConnectionMode = cmAny
  Background.Fixed = False
  HandleTabs = False
  LeftToRight = True
  LockUntilLoaded = True
  LockOnSubmit = True
  ShowHint = True
  DesignLeft = 4
  DesignTop = 4
  object IWTabControl1: TIWTabControl
    Left = 0
    Top = 0
    Width = 1130
    Height = 914
    RenderInvisibleControls = True
    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
    Align = alClient
    BorderOptions.NumericWidth = 0
    BorderOptions.Style = cbsNone
    Color = clWebSILVER
    ClipRegion = False
    TabPadding = 0
    ActiveTabBorder.Color = clWebBLACK
    ActiveTabBorder.Width = 0
    InactiveTabBorder.Color = clWebBLACK
    InactiveTabBorder.Width = 0
    ExplicitLeft = 88
    ExplicitTop = 80
    ExplicitWidth = 60
    ExplicitHeight = 60
    DesignSize = (
      1130
      914)
    object IWTabControl1Page1: TIWTabPage
      Left = 0
      Top = 20
      Width = 1130
      Height = 894
      RenderInvisibleControls = True
      TabOrder = 1
      Title = 'Page1'
      BorderOptions.NumericWidth = 0
      BorderOptions.Style = cbsNone
      Color = clWebWHITE
    end
    object IWTabControl1Page2: TIWTabPage
      Left = 0
      Top = 20
      Width = 1130
      Height = 894
      RenderInvisibleControls = True
      TabOrder = 2
      Title = 'Page2'
      BorderOptions.NumericWidth = 0
      BorderOptions.Style = cbsNone
      Color = clWebWHITE
    end
    object IWTabControl1Page0: TIWTabPage
      Left = 0
      Top = 20
      Width = 1130
      Height = 894
      RenderInvisibleControls = True
      Title = 'Page0'
      BorderOptions.NumericWidth = 0
      BorderOptions.Style = cbsNone
      Color = clWebWHITE
      object IWButton1: TIWButton
        Left = 184
        Top = 184
        Width = 120
        Height = 30
        Caption = 'IWButton1'
        Color = clBtnFace
        FriendlyName = 'IWButton1'
        OnAsyncClick = IWButton1AsyncClick
      end
    end
  end
end
Reply
#2
AsyncReload() is a way to force the component to render again in the HTML page. If it works in this case, I think it is safe to use it.

PS: I strongly suggest you to experiment with the new IWjQPageControl which is awesome in so many ways.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)