TcxCustomFilterControl.Localize Method
Assigns values of the resource strings to the corresponding text elements of a filter control.
Declaration
procedure Localize;
Remarks
Use the Localize method when you need to update values of the text elements displayed within a filter control (such as popup menu items text, control elements text, logical operators, comparison operators, empty value text) based upon the changed values of the corresponding resource strings.
String constants for filter controls are stored as resources in the cxFilterControlStrs
unit. Moving display strings into string resources makes an application easier to localize without rewriting the program. For localization purposes, you might want to substitute values of specific resource strings. For this to be done, you should perform the following two steps:
- Change specific resource strings’ values.
To change a resource string, use the cxSetResourceString procedure available within the dxCore unit. This procedure substitutes the value of the resource string during execution only. Note that a new value does not replace a resource in an executable file.
For instance, you may use the following code lines to specify German equivalents for resource strings representing items of a filter control’s popup menu.
cxSetResourceString(@cxSFilterAddCondition, 'Kondition hinzfügen');
cxSetResourceString(@cxSFilterAddGroup, 'Gruppe hinzfügen');
cxSetResourceString(@cxSFilterClearAll, 'Alles löschen');
cxSetResourceString(@cxSFilterRemoveRow, 'Zeile löschen');
- Call the Localize method.
The Localize method retrieves resource strings settings with the help of the cxGetResourceString function and assigns the obtained values to the corresponding filter control’s text elements.
As a result, when a popup menu is called, it contains items translated into German.