Autor Beitrag
Handycommander
ontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1054

Windows XP Pro, Vista
Visual Studio 2008
BeitragVerfasst: Fr 25.03.05 12:17 
Hi,

also ich habe 2 ListViews.
- eine mit zwei Spalten in der einen steht die überschrift und in der anderen die größe
- die zweite ListView hat unendlich viele spalten

also mein problem:
wie kann ich es machen, dass ich von der einen listview mit der überschrift und größe in der zweiten listview eine Spalten anlegen kann, mit der überschrift und der größe aus listview1?

kann mir da jemand weiter helfen?

danke

tobias


Moderiert von user profile iconAXMD: Topic aus Sonstiges verschoben am Fr 25.03.2005 um 12:58
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Fr 25.03.05 13:00 
user profile iconHandycommander hat folgendes geschrieben:

- die zweite ListView hat unendlich viele spalten

Die will ich sehen; und sag jetzt bitte nicht, dass das nicht geht, weil sie aus Antimaterie ist...
user profile iconHandycommander hat folgendes geschrieben:
also mein problem:
wie kann ich es machen, dass ich von der einen listview mit der überschrift und größe in der zweiten listview eine Spalten anlegen kann, mit der überschrift und der größe aus listview1?

Schau dir mal die Columns-Eigenschaft an und schau, dass du nicht die konjugiert komplexe nimmst :rofl:

AXMD

Sorry, aber unendlich viele Spalten is einfach zum Schreien :rofl:
Handycommander Threadstarter
ontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1054

Windows XP Pro, Vista
Visual Studio 2008
BeitragVerfasst: Fr 25.03.05 13:23 
habs schon versucht. aber irgendwie kann ich die spalten schon einfügen mit der caption aber nicht die größe der dazugehörigen spalte.

sorry für den ausdruck "unendlichviele spalten"
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Fr 25.03.05 13:28 
Ein Blick in die OH und du wüsstest, dass man die Spaltengröße per Property verstellen kann ;)

AXMD
Handycommander Threadstarter
ontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1054

Windows XP Pro, Vista
Visual Studio 2008
BeitragVerfasst: Fr 25.03.05 19:44 
hab das jetz so gemacht. nur klappt das leider nicht. was mach ich falsch?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
var
  I: Integer;
begin
  for I := 0 to ListView1.Items.Count-1 do
  begin
    Form1.DBAdvListView1.Columns.Insert(I);
    Form1.DBAdvListView1.Column[I].Width := StrToInt(ListView1.Items.Item[I].SubItems.Text);
    Form1.DBAdvListView1.Column[I].Caption := ListView1.Items.Item[I].Caption;
  end;


danke

tobias
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Fr 25.03.05 21:07 
Nimm mal Add statt Insert ;). Du fügst an eine Stelle ein, die es nicht gibt ;)

AXMD
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Fr 25.03.05 22:31 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
var  
  I: Integer;  
begin  
  for I := 0 to ListView1.Items.Count-1 do  
  begin  
    with Form1.DBAdvListView1.Columns.Add do
    begin  
      Width := StrToInt(ListView1.Items.Item[I].SubItems.Text);  
      Caption := ListView1.Items.Item[I].Caption;
    end;  
  end;
end;

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Handycommander Threadstarter
ontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1054

Windows XP Pro, Vista
Visual Studio 2008
BeitragVerfasst: Sa 26.03.05 19:30 
hallo,

da kommt der selbe fehler wieder:

ausblenden Quelltext
1:
2:
'90
' is not a integer value.


was kann ich da noch machen?

danke

tobias
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Sa 26.03.05 19:34 
:gruebel: Du hast Hochkommas vor die Zahl gemacht?? :shock: Nicht wirklich, oder?? Mach mal die weg... ;)
Handycommander Threadstarter
ontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1054

Windows XP Pro, Vista
Visual Studio 2008
BeitragVerfasst: Sa 26.03.05 19:35 
nein. da sind keine hochkommas.
ich hab ganz normale zahlen eingegeben!
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Sa 26.03.05 20:43 
Dann poste doch mal schnell den Code... ;)
Handycommander Threadstarter
ontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1054

Windows XP Pro, Vista
Visual Studio 2008
BeitragVerfasst: Sa 26.03.05 20:51 
der code is der selbe, wie oben!
also:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
var    
  I: Integer;    
begin    
  for I := 0 to ListView1.Items.Count-1 do    
  begin    
    with Form1.DBAdvListView1.Columns.Add do  
    begin    
      Width := StrToInt(ListView1.Items.Item[I].SubItems.Text);    
      Caption := ListView1.Items.Item[I].Caption;  
    end;    
  end;  
end;


danke
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Sa 26.03.05 20:53 
:rofl: Achso... *g* Ich dacht schon du hast sowas geschrieben:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
var    
  I: Integer;    
begin    
  for I := '90' to ListView1.Items.Count-1 do    
  begin    
    with Form1.DBAdvListView1.Columns.Add do  
    begin    
      Width := StrToInt(ListView1.Items.Item[I].SubItems.Text);    
      Caption := ListView1.Items.Item[I].Caption;  
    end;    
  end;  
end;


Also isses kein Compiler-Error, sonder der Fehler kommt erst zur Laufzeit!?!?!
Handycommander Threadstarter
ontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1054

Windows XP Pro, Vista
Visual Studio 2008
BeitragVerfasst: Sa 26.03.05 21:00 
ja, der fehler kommt, wenn ich auf den button klicke.
also während der laufzeit.

kann das ' vielleicht ein trennzeichen von den spalten sein?
wie krieg ich das weg?

danke
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: Sa 26.03.05 21:14 
So wie's aussieht, hat's ein Return nach der Zahl => Trim
Handycommander Threadstarter
ontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1054

Windows XP Pro, Vista
Visual Studio 2008
BeitragVerfasst: Sa 26.03.05 21:17 
was heißt das genau?
wie kann ich den fehler wegmachen?

danke
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Sa 26.03.05 22:57 
Hallo,

vermutlich entsteht der Fehler in der Codezeile:
ausblenden Delphi-Quelltext
1:
Width := StrToInt(ListView1.Items.Item[I].SubItems.Text);					

Die Funktion StrToInt versucht '90 in einen Integer umzuwandeln.
90 wird wahrscheinlich eine Spaltenbreite sein die Du in ListView1 eingetragen hast.
Überprüf mal die Eintrags-Routine der ListView1, ob da schon das Hochkomma eingetragen wird.

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )