procedure LocalizeMapping(var MappingRecord: array of TJwRightsMapping; const StartStringId: Cardinal; const PrimaryLanguageId: Word; const SubLanguageId: Word; const UseDefaultOnError: Boolean = true; ModuleInstance: HINST = 0);
|
Parameters |
Description |
|
var MappingRecord: array of TJwRightsMapping |
@italic([in,out]) receives an array of TJwRightsMapping which string member Name is replaced by the resource string. |
|
const StartStringId: Cardinal |
defines the starting position of the index counting. It must be an absolute resource string index, which context contains a number that defines the count of array elements. |
|
const PrimaryLanguageId: Word |
defines the primary language id. use PRIMARYLANGID(GetUserDefaultUILanguage), SUBLANGID(GetUserDefaultUILanguage) to get user language. |
|
const SubLanguageId: Word |
defines the sub language id. |
|
const UseDefaultOnError: Boolean = true |
defines whether EJwsclResourceNotFound is thrown if a resource index is invalid (could not be found in resource) (false) or not (true). If UseDefaultOnError is true the function does the following.
|
|
ModuleInstance: HINST = 0 |
defines where the resource strings can be found. It is simply put through to LoadString function. It can be an instance of a dll file which contains localized versions of the strings. |
LocalizeMapping loads the resource strings of a TJwRightsMapping record array defined in JwsclTypes.pas. To convert a rights mapping record array define a start resource string index, say 4000. This is the starting point of the resource strings, but it does not define a string. It simply contains a number that defines the count of array elements, say 4. So the record array must look like this :
MyMapping: array[1..4] of TJwRightsMapping = ( (Right: STANDARD_RIGHTS_ALL; Name: 'STANDARD_RIGHTS_ALL'; Flags: 0; StringId : 5008), (Right: STANDARD_RIGHTS_READ; Name: 'STANDARD_RIGHTS_READ'; Flags: 0), (Right: STANDARD_RIGHTS_WRITE; Name: 'STANDARD_RIGHTS_WRITE'; Flags: 0), (Right: STANDARD_RIGHTS_EXECUTE; Name: 'STANDARD_RIGHTS_EXECUTE'; Flags: 0));
Each element is linked to the resource string. e.g. MyMapping[1].Name is read from string resource with index [4001] MyMapping[2].Name is read from string resource with index [4002] and so on. So the last index of the array (here 4) is resource index [4004].
There is the possibility to use exceptional indexes. To do so set StringId member of the TJwRightsMapping to an index which starts at "StartStringId". The positive number will be increased by the parameter StartStringId to get the resource string index. E.g. set StringId to 20 to load the resource string from
index [4020] (= <StartStringId> + 20)
It is also possible to use absolute values - like 4020. To use them simply negate the StringId. e.g. StringID: "-4020" will load index [4020]. It is discouraged to use absolute values because they do not depend on the parameter StartStringId. Changing this value and the resource strings will lead to EJwsclResourceNotFound exception.
|
Exceptions |
Description |
|
is raised if the given value in parameter StartStringId could not be found in the string resource | |
|
is raised if the count of the members of the given array (MappingRecord) is not equal to the number given in the resource string at index StartStringId. | |
|
is raised if UseDefaultOnError is false and a given resource index of a member of the array of TJwRightsMapping could not be found |
|
Copyright (c) 2010. All rights reserved.
This help was created by Doc-O-Matic sponsored by toolsfactory software inc. |
|
What do you think about this topic? Send feedback!
|