Switching languages on Login form. Mainform does not reflect

All announcements, questions and issues related to the TsiLang Components Suite.
Post Reply
adrian
Posts: 13
Joined: Sat Jun 11, 2005 7:07 pm
Contact:

Switching languages on Login form. Mainform does not reflect

Post by adrian »

I have a Delphi project I'm translating.
Mainform, and CustomLoginForm are autocreate.
All other forms not.
The project starts by running the mainform.
On the mainform I have:
siLang1, and siLangDispatcher1
On CustomLoginForm I have siLang1.LangDispatcher := MainForm.siLangDispatcher1

On running the Mainform starts, and in on create event, it calls the CustomLoginForm.
The language is changed to 2 from 1 using radiobuttons, and the change is reflected. When the code continues in the On Create event of the Mainform, after successfull login, I check for siLangDispatcher.activelanguage, and it is 2. This is what I would expect.
When the form then eventually displays, it displays language 1, and not 2.
I Have a menu on the form to change language after runtime, so I decided to test for the activelanguage after login, then depending on value activate the onclick event for the specific language in the menu, but all this does is reflect the nr 2 language as selected, but nr 1 language still the actual display language. Only if I select the nr 2 language after the form has displayed from the menu does it accurately reflect the language. I think is has to do with the language actually allready fixed to 1 before the on create event, and that it cannot be changed until the form has displayed?

Please help. I hope I have been complete enough.
isiticov
Site Admin
Posts: 2385
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

At http://www.sicomponents.com/soft/demos/LoginForm.zip is the demo reconstructed based on your description. And it works perfectly. Could you please check if it works the same for you and in case you use different code, please try to introduce your code in order to reproduce the problem?
Best regards,
Igor Siticov.
adrian
Posts: 13
Joined: Sat Jun 11, 2005 7:07 pm
Contact:

Post by adrian »

The only difference is that your login form is not in the autocreate of the project. You are also using silangLinked, while I'm using siLang.

I moved the CustomLoginForm from autocreate, and now it is working as I would expect.

Could you perhaps ellucidate the reason for this?

Thanks for your prompt help.

Regards

Adrian
isiticov
Site Admin
Posts: 2385
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

1. Using TsiLangLinked couldn't be a reason. I just used it automatically :)
2. Login form in our sample project was "auto-created" but with way a bit different than Delphi auto-creates forms. May be the reason of such behavior on your side was that login form was created before the form with dispatcher? Anyway, if you reproduce the sample project with same behavior and send it to us it would be easier to find a reason.
Best regards,
Igor Siticov.
Post Reply