I want to set the caption to all controls (Tlabel, Tbutton, Teditlabel, Tbitbtn, TGroupBox, etc) and all components (TMenuItems, TActions) that have a caption from a language file.
My problem is that Caption is not public in TComponent, TControl or even TWinControl. Even more, some 'common' controls like TLabel/TBitBtn are not even derived from TWinControl.
Example:
void SetCaptionAll(TComponent *container)
{
for (int i = 0; i < container->ComponentCount; i++)
{
TComponent *child = container->Components[i];
child->Caption = ReadFromFile; <-- This won't work. Caption is private
}
}
Most important: I don't want to use a macro (I think this is what is called) like:
#define GetCtrlCaption(p)\
{ code here }
because this is not debugable.
I need C++ Builder example, but Delphi is accepted also.