You are not logged in.

  • Login

Dear visitor, welcome to Coder Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Monday, October 9th 2006, 11:24am

Borland C++ Builder Caption-Problem

Hallo,
habe ein Problem mit der umbenenung der Captions.
Erstmal mein Queltext:

C Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
AnsiString getName(AnsiString ObjName,AnsiString Sprache)
{
   	AnsiString BuCaption;
 
	// Laden des XML-Documents
   	_di_IXMLDocument LangXML = LoadXMLDocument("lang.xml");
    // Liste in der Unterknoten
    _di_IXMLNodeList NodeList = LangXML->DocumentElement->ChildNodes;
    // Suchen des Namens in der XML-Datei
    _di_IXMLNode ObjNameNode = NodeList->FindNode(ObjName);
    BuCaption = ObjNameNode->ChildNodes->FindNode(Sprache)->NodeValue;
 
    return BuCaption;
}
 
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
	: TForm(Owner)
{
	// Ausgabe der Anzahl der Objekte
	int i = 0;
	i=	Form2->ComponentCount;
	Button_Para->Caption = i;
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Button_BerPrClick(TObject *Sender)
{
	// Suchen nach dem Namen der Objekte und Ausgabe der Namen
 
	AnsiString ObjName[5];
    AnsiString CaptionName[5];
 
    for (int i=0; i< Form2->ComponentCount;i++)
 
		{
       		ObjName[i] = Form2->Components[i]->GetNamePath();
        	CaptionName[i] = getName(ObjName[i], "eng");
 ----> !!!    Form2->Components[i]->Caption = CaptionName[i];  !!!<---------
        }
}
...


Also, das Programm soll die Buttons aus dem Form2 finden und dessen Captions ändern, in dem er nach dem Objektnamen in einer XML-Datei sucht und dort die Caption-Bennenung herausfiltert. Das hat den Vorteil, dass ich später nur noch die Buttons einfügen muss ohne sie je nach Sprache immer wieder zu ändern. Er sucht sich somit je nach Sprache (English Deutsch Polnisch Französische.) die Captions heraus. Das suchen funktioniert ohne Probleme. Leider kann ich die Captions nicht umbennen. Der Compiler meckert, das Caption keine Komponente von TComponent ist. Soweit so gut. Das stimmt ja auch. Dennoch erbt aber TControl von TComponent, somit alle Methoden. Dennoch funktioniert dieses nicht. Gibt es eine Möglichkeit hier ganz einfach die Captions in der Schleife zu ändern ohne große Veränderungen zu machen?

Bitte antwortet mir.
Danke!

Social bookmarks