SiComponents Home Page SiComponents Forums
Here you will be able to get help and share your experience
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

User may create forms at runtime

 
Post new topic   Reply to topic    SiComponents Forums Forum Index -> TsiLang Components Suite
View previous topic :: View next topic  
Author Message
Eric ten Westenend



Joined: 05 Aug 2005
Posts: 10

PostPosted: Wed Aug 10, 2005 7:48 am    Post subject: User may create forms at runtime Reply with quote

Hello,

I'm new to TsiLanguage and wonder if this is possible.
With our application it's possible the user create a new database table and designs a form around it. Its is possible to include the new string in the sil file at runtime and let the user translate them?

Eric
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2102

PostPosted: Wed Aug 10, 2005 11:49 am    Post subject: Reply with quote

On creating some form at run-time you can also create a TsiLang component on it and assign its dispatcher property to one used in project. After that you can perform the following:
1. Call BuildList method. This will create translations lists in TsiLang.
2. Call SaveAllToFile (SaveAllToBinaryFile) to save lists to file
3. Call LoadAllFromFile (LoadAllFromBinaryFile) to load lists from file.

Hope this helps.
Back to top
View user's profile Send private message
Eric ten Westenend



Joined: 05 Aug 2005
Posts: 10

PostPosted: Wed Aug 10, 2005 9:00 pm    Post subject: Reply with quote

Thanks, will try it directly.
Back to top
View user's profile Send private message
Eric ten Westenend



Joined: 05 Aug 2005
Posts: 10

PostPosted: Thu Aug 11, 2005 7:20 am    Post subject: Reply with quote

Hello,

I tried this:

On a buttonclick i runtime create a form with a groupbox on it with the items 'One' , 'Two'.
I also create a TsiLangLinked component on the form and connect it using
the "CommonContainer" and "LangDispatcher" to the "TsiLangDispatcher" and "TsiLangRT" components on the main form.

Now i can call TsiLangLinked method "BuildList" and "SaveAllToFile" but how can i call the sil editor to only edit the list created by "BuildList"

Eric
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2102

PostPosted: Thu Aug 11, 2005 8:23 am    Post subject: Reply with quote

Eric ten Westenend wrote:

Now i can call TsiLangLinked method "BuildList" and "SaveAllToFile" but how can i call the sil editor to only edit the list created by "BuildList"

Could you please describe what do you mean?
In case you need to edit created SIL file then just run SIL Editor with this SIL file in command line. Or you can import SIL Editor type library and use COM interface to manage it.
Back to top
View user's profile Send private message
Eric ten Westenend



Joined: 05 Aug 2005
Posts: 10

PostPosted: Thu Aug 11, 2005 10:24 am    Post subject: Reply with quote

The code:

procedure TForm1.Button1Click(Sender: TObject);
var
f : TForm;
gb : TRadioGroup;
b : TButton;
begin
//create the form
f := TForm.Create(self);
f.Caption := 'Test form';
f.Position := poScreenCenter;

// create a rodiogroup on the form
gb := TRadioGroup.Create(f);
gb.Parent := f;
gb.Top := 50;
gb.Left := 50;
gb.Items.Add('Een');
gb.Items.Add('Twee');
gb.Items.Add('Drie');

// create a TsiLangLinked on the form
siLangLinked1:= TsiLangLinked.Create(f);
siLangLinked1.CommonContainer := siLangRT1;
siLangLinked1.LangDispatcher := siLangDispatcher1;

// Create a button to do the translation
b := TButton.Create(f);
b.Caption := 'Translate';
b.OnClick := DoClick;
b.Parent := f;
b.Top := 175;
b.Left := 50;

f.ShowModal;

f.Free;
end;

procedure TForm1.DoClick(Sender: TObject);
begin
siLangLinked1.BuildList;
siLangLinked1.SaveAllToFile('C:\Test.sil','#');
end;

After this i can open "Test.sil" but the sil file only contaings the caption on the form. Not the button neither the radiogroup.

I could mail you the project if you want.

Eric
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2102

PostPosted: Thu Aug 11, 2005 12:00 pm    Post subject: Reply with quote

Just assign for each created component the Name property. TsiLang skips all components that have no Name property defined.
Back to top
View user's profile Send private message
Eric ten Westenend



Joined: 05 Aug 2005
Posts: 10

PostPosted: Thu Aug 11, 2005 4:52 pm    Post subject: Reply with quote

Great, thanks, that worked! Life can be that easy.

Now, when i rightclick the TsiLangLinked component in designtime i can call the editor. Can't find a method on this component to do the same at runtime.

Can this be done?

Eric
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2102

PostPosted: Thu Aug 11, 2005 6:15 pm    Post subject: Reply with quote

Smile Only using TsiLangRT. Or as I said earlier using SIL Editor OLE server.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    SiComponents Forums Forum Index -> TsiLang Components Suite All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by p h p B B  © 2001, 2005 p h p B B  Group