Switching languages on Login form. Mainform does not reflect
Posted: Sun Jun 12, 2005 8:27 pm
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.
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.