Page 1 of 1

Access to a dedicated Caption of TsiLang

Posted: Thu Nov 08, 2007 2:37 pm
by Thomas J.
How can I access a dedicated caption of TsiLang component?
Caption property is type of TStrings and I need one dedicated String out of the Caption property.
For example I want to change the caption of the TForm in depend of record selection like "Contract 2007/003493" and the original caption is "Contract".

Thanks
Thomas

Posted: Thu Nov 08, 2007 4:21 pm
by isiticov

Code: Select all

procedure ReplaceStringValue(const AStrings: TStrings; Value, AName: Tstring; ALang: Integer);  
But I would recommend for such cases use OnChangeLanguage event and set caption in code using GetTextOrDefault() method.

Posted: Fri Nov 09, 2007 2:42 pm
by Thomas J.
No I think you dind't understand me correct.

The origin caption is "Contract" for the form and if no dataset is show in the form is this caption "Contract" correct.

Now the user create a contract and the system generate a no. like 2007-11-11-1 so the caption has to change to "Contract 2007-11-11-1"

If the user creates a second contract the caption has to be "Contract" + " " + no --> e.g. "Contract 2007-11-11-2"
But for this I have to get the original caption wich is "Contract"

right now I store the caption in the OnCreate event in a member variable and use it if the user select or create a new record.

Posted: Fri Nov 09, 2007 3:03 pm
by isiticov
Then I would recommend to store caption Contract in Strings section and set form's caption using GetTextOrDefault. Lately you just combine it with necessary contract no.

Posted: Fri Nov 09, 2007 3:34 pm
by Thomas J.
Yes that's one solution, but I cannot acces a dedicated string from property Caption?

Posted: Sat Nov 10, 2007 6:20 am
by isiticov

Code: Select all

GetStringValue(const AStrings: TStrings; AName: string; ALang: nteger): string;
Please note: once you change caption of the form and switch language TsiLang will automatically remember changed caption for the language that was active!