Autor Beitrag
FrankTheFox
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Do 15.05.08 18:01 
Hallo,

ich möchte per Code TCheckgroups oder TcxCheckGroups (TRadioGroups) Items hinzufügen.

Kann mir jemand ganz langsam und zum mitschreiben erklären wie ich das anstellen kann (oder es gleich sein lassen!)

Gruß

Franky
Jerk
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 251

Vista Ultimate, Ubuntu
Turbo Delphi 2006
BeitragVerfasst: Fr 16.05.08 00:09 
Falls ich dich nicht falsch verstehe,

add heist auf Deutsch übersetzt hinzufügen und da du ja ein Item hinzufügen willst würde ich es mal mit beliebigekomponente.items.add('Hallo Welt'); probieren
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Fr 16.05.08 06:52 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
Var
  item : TcxCheckGroupItem;

Begin
  item := MycxCheckGroup.Properties.Items.Add;
  item.Caption := 'My item';
  item.Enabled := True;


Die DevExpress-Komponenten sind schon etwas überladen, insofern muss man wirklich manchmal suchen. ALLE Editoren haben eine Eigenschaft 'Properties', hinter dem sich alle klassenspezifischen Eigenheiten des konkreten Editors verbergen. Eigentlich ist das gut duchdacht, man muss nur einmal die Klassenstruktur verstehen.

_________________
Na denn, dann. Bis dann, denn.
FrankTheFox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Fr 16.05.08 09:44 
Titel: Ja, danke...
Hallo,

user profile iconalzaimar hat folgendes geschrieben:

Die DevExpress-Komponenten sind schon etwas überladen, insofern muss man wirklich manchmal suchen. ALLE Editoren haben eine Eigenschaft 'Properties'...


Ok, das habe ich definiert...

ausblenden Delphi-Quelltext
1:
2:
3:
Var
   MyTcxCheckGroup : TcxCheckGroup;
   MyTcxCheckGroupItem: TcxCheckGroupItem;

...
ausblenden Delphi-Quelltext
1:
2:
3:
4:
 MyTcxCheckGroupItem.Caption:=TcxCheckGroupItemParam[i].Caption;
 MyTcxCheckGroupItem.Enabled:=TcxCheckGroupItemParam[i].Enabled;
 MyTcxCheckGroupItem.Tag:=TcxCheckGroupItemParam[i].Tag;
 MyTcxCheckGroup.Properties.Items.Add;


aber ich weiß nicht wie ich ein solches Objekt erzeuge. Ich meine ich muß doch MyTcxCheckGroupItem
erst erzeugen, aber wie?


Gruß
Franky
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Fr 16.05.08 09:47 
[ ] Dir ist aufgefallen, das die 'Add' Methode eine Funktion ist, die ein TcxCheckGroupItem zurückliefert.

Vergleiche nochmal meinen mit deinem Code und Du wirst die Antwort finden.

_________________
Na denn, dann. Bis dann, denn.
FrankTheFox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Fr 16.05.08 09:54 
Titel: Auweia.....
Hallo,


ja ich hab's jetzt und lege mich erstmal schlafen. 'Ne Nacht durch zu programmieren, hat schon immer geschadet!

ausblenden Delphi-Quelltext
1:
2:
3:
4:
MyTcxCheckGroupItem:=MyTcxCheckGroup.Properties.Items.Add;
MyTcxCheckGroupItem.Caption:=TcxCheckGroupItemParam[i].Caption;
MyTcxCheckGroupItem.Enabled:=TcxCheckGroupItemParam[i].Enabled;
MyTcxCheckGroupItem.Tag:=TcxCheckGroupItemParam[i].Tag;


Dann klappt's auch mit...


Gruß
Franky
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Fr 16.05.08 09:56 
Ein Fehler weniger, aber immer noch einer zuviel. Die FUNKTION 'Add' LIEFERT doch etwas.

_________________
Na denn, dann. Bis dann, denn.
FrankTheFox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Fr 16.05.08 10:27 
Titel: hä...
Ja und das heisst...? Ich steh' auf dem Schlauch!
Ich dachte das
ausblenden Delphi-Quelltext
1:
MyTcxCheckGroupItem:=MyTcxCheckGroup.Properties.Items.Add;					
genau so wie
ausblenden Delphi-Quelltext
1:
item := MycxCheckGroup.Properties.Items.Add;					
das Item erzeugt und es dann benutzt werden kann.
Ich seh' den Fehler nicht.


Gruß
Franky
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Fr 16.05.08 10:32 
Hupsa, mein Fehler...

ausblenden Delphi-Quelltext
1:
2:
3:
MyTcxCheckGroupItem.Caption:=TcxCheckGroupItemParam[i].Caption;
MyTcxCheckGroupItem.Enabled:=TcxCheckGroupItemParam[i].Enabled;
MyTcxCheckGroupItem.Tag:=TcxCheckGroupItemParam[i].Tag;

Was soll das bedeuten? probier doch mal meinen Code aus. Funktioniert er?

_________________
Na denn, dann. Bis dann, denn.
FrankTheFox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Fr 16.05.08 12:03 
Titel: Jupp, tut er...
ich erzeuge aus einer XML Datei mehrere cxCheckGroupItem, darum das [i]. Die Formulierung "TcxCheckGroupItemParam" ist nur völlig für den *popo* und wird noch geändert.
Aber der Code funktionert! Danke für's helfen!


Gruß
Franky
FrankTheFox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Mo 19.05.08 10:11 
Titel: Ich habe da noch ein Problem....
...ich kann nur zwei Items selektieren. Bei drei Items die ich einfüge, springt er bei dem in der Mitte sofort auf das erste. Bei vier Items kann ich nur eins selektieren (nur das erste), egal welches ich anklicke. Ich bin ratlos. Weiß jemand warum das so ist?


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
...
for i:= 0 to high(TcxRadioGroupItemParam) do
   begin
     MyTcxRadioGroupItem:=MyTcxRadioGroup.Properties.Items.Add ;
     MyTcxRadioGroupItem.Caption:=TcxRadioGroupItemParam[i].Caption;
     MyTcxRadioGroupItem.Value:=TcxRadioGroupItemParam[i].Value;
   
...  
   end;

   TcxRadioGroupParams.Parent.InsertComponent(MyTcxRadioGroup);

end;


Gruß
Franky
FrankTheFox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Mo 19.05.08 11:45 
Titel: Ok, eine kleine Lösung...
wenn ich die einzelnen Items (ich erzeuge 4 Radiogroups) alle benenne (d.h. für jedes Groupitem die Caption Eigenschaft setze) und das unterschiedlich (also Gruppe 1 -> Eins Zwei Drei, Gruppe2 -> Einser, Zweier, Dreier,...) dann scheint's zu funktionieren, aber warum? Sobald nur innerhalb einer Gruppe von zwei Items die Caption gleich sind selektiert er nur einen oder max. zwei). Jede Gruppe hat mind. 3 Items (erstmal testweise...)

Hä???



Gruß
Franky