Autor Beitrag
hansa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: So 29.10.06 21:32 
user profile iconLinzerASK hat folgendes geschrieben:
also ich habe jetzt echt keinen plan mehr. danke für
eure bemühungen.


mkinzler hat mir die Arbeit trotzdem abgenommen. :mrgreen:

_________________
Gruß
Hansa
LinzerASK Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 135

WIN XP
Delphi 4, Delphi 2005
BeitragVerfasst: So 29.10.06 21:52 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
procedure TForm1.Button5Click(Sender: TObject);
var i:integer;
begin


p:=p^.nachbar;

for i:=i to spinedit2.value do //bis vor die einzufügende Stelle nach hinten gehen

q:= p^.nachbar; //q ist Eintrag der gelöscht werden soll
p^.nachbar:= q^.Nachbar; //Vorgänger zeigt nun auf Nachfolger
Dispose(q); // Löscht q






end;
hansa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: So 29.10.06 21:58 
Ja, das sieht gut aus. :D So in der Richtung geht das.

_________________
Gruß
Hansa
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: So 29.10.06 22:03 
Eher

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure TForm1.Button5Click(Sender: TObject);
var i:integer;
begin

    p := Erster;

    for i:=2 to spinedit2.value<span style="color: orange">-1</span> do //bis vor die einzufügende Stelle    nach hinten gehen
        p:=p^.nachbar;

    q:= p^.nachbar; //q ist Eintrag der gelöscht werden soll
    p^.nachbar:= q^.Nachbar; //Vorgänger zeigt nun auf Nachfolger
    Dispose(q); // Löscht q

end;

_________________
Markus Kinzler.
LinzerASK Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 135

WIN XP
Delphi 4, Delphi 2005
BeitragVerfasst: So 29.10.06 22:03 
wenn ich das aber so mache - Fehlermeldung.
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: So 29.10.06 22:10 
user profile iconLinzerASK hat folgendes geschrieben:
wenn ich das aber so mache - Fehlermeldung.

Was für einer und wo?

_________________
Markus Kinzler.
LinzerASK Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 135

WIN XP
Delphi 4, Delphi 2005
BeitragVerfasst: So 29.10.06 22:16 
muss mich korrigieren.

ich setze bei i:=1 nicht i:=2 ...

dann starte ich das programm, und drücke start. dann stelle ich spinedit auf 3 und dann auf verkaufen-button, so, jetzt klicke ich per nächster-button durch , es wird nicht der 3 vorne gelöscht - sondern der 3 von hinten!
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: So 29.10.06 22:19 
Der 3. von Hinten, welcher ist das von Vorne? Hat du die Grenzen beachtet?

_________________
Markus Kinzler.
LinzerASK Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 135

WIN XP
Delphi 4, Delphi 2005
BeitragVerfasst: So 29.10.06 22:25 
ich hab das jetzt so reinkopiert wie du es programmiert hast!
LinzerASK Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 135

WIN XP
Delphi 4, Delphi 2005
BeitragVerfasst: So 29.10.06 22:26 
ich habe das jetzt so reinkopiert in die prozedur, wie du es mir geschrieben hast.
LinzerASK Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 135

WIN XP
Delphi 4, Delphi 2005
BeitragVerfasst: So 29.10.06 22:29 
wobei ich eins nicht verstehe nimmst du i:=2 weil do dann ja spinedit1.value-1 programmierst????
hansa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: So 29.10.06 22:31 
An dieser Stelle :

user profile iconLinzerASK hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
for i:=i to					


da ist ein Fehler wirklich zu befürchten. :lol: Das nächste wäre eine Frage : wieso vermischst Du starre Elemente wie TStringList etc. mit verketteten Listen ? :shock:

_________________
Gruß
Hansa
LinzerASK Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 135

WIN XP
Delphi 4, Delphi 2005
BeitragVerfasst: So 29.10.06 22:33 
:lol: aber wieso jetzt wirklich 2 ...
mir ist ja das andere alles logisch - aber 2 :-D
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: So 29.10.06 22:37 
p steht ja schon auf dem Ersten Element der Liste. wie oft mußt du weiterschalten um auf das 3. zu kommen?
Das -1 ist weil ich ja den Vorgänger des zu löschenden Eitrags brauche.

_________________
Markus Kinzler.
hansa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: So 29.10.06 22:55 
wundert mich, daß übehaupt was gemacht wird. Verhindert die Pseudo-Schleife das nicht komplett ?

_________________
Gruß
Hansa
LinzerASK Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 135

WIN XP
Delphi 4, Delphi 2005
BeitragVerfasst: Mo 30.10.06 08:00 
es funktioniert auch nicht wirklich, einmal wird ein eintrag gelöscht, dann wieder doch nicht...usw.
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mo 30.10.06 09:00 
Wie viele Einträge hast du?
Zeig mal den aktuellen Code.

_________________
Markus Kinzler.
hansa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: Mo 30.10.06 09:11 
Auch das ist nicht verwunderlich. Schließlich bist Du jetzt soweit, eine dynamische Datenstruktur, nämlich die verkettete Liste mit einer starren FOR-Schleife zu belästigen. :lol: Das passt eben nicht zusammen und führt zu Irritationen. Baue die Liste auf und zwar wie gehabt. Als 1:1 Abbildung der Tabelle und lasse sie danach in Ruhe. Was angezeigt wird, das ist eine andere Sache. Hätte die Liste 10000 Einträge und irgendein Depp würde sich tatsächlich die Mühe machen, da 2000 Einträge temporär von Hand auszublenden, ja dann würde es eventuell Sinn machen den Speicherplatz zu minimieren. Aber eben auch nur temporär. 8)

_________________
Gruß
Hansa
LinzerASK Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 135

WIN XP
Delphi 4, Delphi 2005
BeitragVerfasst: Mo 30.10.06 09:39 
soll ich euche jetzt das ganze programm hochladen?
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mo 30.10.06 10:02 
user profile iconLinzerASK hat folgendes geschrieben:
soll ich euche jetzt das ganze programm hochladen?

Spricht eigentlich nichts dagegen.

_________________
Markus Kinzler.