IntraWeb : how to dispatch?

All announcements, questions and issues related to the TsiLang Components Suite.
Post Reply
rhodan
Posts: 5
Joined: Tue Jan 14, 2003 6:02 pm

IntraWeb : how to dispatch?

Post by rhodan »

Hi,
I'm trying to use TSiLang component with Intraweb solution (with D7 Ent.), but I don't understand how to create a Dispatcher. I'm trying to use a DataModule create with User's Session but when user switch Language it raises an exception.

Some Help?

Rhodan
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

I supose that in IntraWeb applications you won't need dispatcher or you may put it onto your IntraWeb form. But I suggest to use "per form language" settings. Just configure manually your IntraWeb form active language depending on user selection or so on.
Also may be we can build a sample IntraWebn application for this case if you provide us simple specification for your case.
rhodan
Posts: 5
Joined: Tue Jan 14, 2003 6:02 pm

Post by rhodan »

Hi from Paris,

Why don't use a Dispatcher. It's more simple to use such a component created in User's Session Class.
If not, how to control in a simple way, all IWForm with a siLang component an each?
I'm looking for a similar way to process between Classical Application and Intraweb Application. It's for our translators :)

Thanks for your answer.

Rhodan
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

We'll try to reproduce this situation. but also it would be helpful if you point us what kind of exception you get. :-)
rhodan
Posts: 5
Joined: Tue Jan 14, 2003 6:02 pm

Detailled Code

Post by rhodan »

Hi,

this is the code used for my IW Application :

-- unit ServerController-----------------------------------------

Code: Select all

unit ServerController;
{PUBDIST}

interface

uses
  SysUtils, Classes, IWServerControllerBase,
  // For OnNewSession Event
  IWApplication, IWAppForm, siComp,
  DataModule_User;

type
  TDMSvrCtler = class(TIWServerControllerBase)
    procedure IWServerControllerBaseNewSession(ASession: TIWApplication;
      var VMainForm: TIWAppForm);
  private
  public
  end;

  // --------- Session Class -------------
  TDMUserSession = Class (TComponent)
  public
        DM_USer : TDM_User;
        constructor Create(AOwner: TComponent); override;
  End;                                                       
implementation
{$R *.dfm}
uses
  IWInit;
constructor TDMUserSession.create(AOwner : TComponent);
Begin
     DM_User := TDM_User.Create(AOwner);
End;
procedure TDMSvrCtler.IWServerControllerBaseNewSession(
  ASession: TIWApplication; var VMainForm: TIWAppForm);
begin
  //ASession.Data := TUserSession.Create;
  ASession.Data := TDMUserSession.Create(ASession);
end;
end.
-- unit DataModule_User -----------------------------------------

Code: Select all

unit DataModule_User;

interface

uses
  SysUtils, Classes, siComp;

type
  TDM_User = class(TDataModule)
    LangDispatcher: TsiLangDispatcher;
  private
  public
    procedure ActiveLang(Num : integer);
  end;
var
  DM_User: TDM_User;

implementation
{$R *.dfm}
Procedure TDM_User.ActiveLang(Num : integer);
Begin
     LangDispatcher.ActiveLanguage := Num;
End;
end.
-------------------------------
On an event I set
DM_User.activeLang(2);
LangDispatcher supports 2 languages.

WepApplication starts fine, but an Event an EAccessViolation occurs in my Application on line : :?
LangDispatcher.ActiveLanguage := Num;

Thanks for your help.

Rhodan
gaivans
Posts: 71
Joined: Fri Nov 29, 2002 4:10 pm

Post by gaivans »

Hello,

We cannot reproduce the problem. Could you send us that project you have tested? Otherwise you can download our small test project from
http://www.sicomponents.com/soft/IW_SiLang.zip and compare with yours.
Best regards,
Serghei Gaivan
rhodan
Posts: 5
Joined: Tue Jan 14, 2003 6:02 pm

Your example works

Post by rhodan »

Hi,

it's annoying, your example works :D
I'm looking for the source of problem in my code, may be the included TMS Component for IW...

In all case thanks for your great support!

Rhodan
Post Reply