Autor Beitrag
Maisinator
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 167

Win XP HE SP3, Win Vista HP SP2
Delphi ;-)
BeitragVerfasst: Sa 01.08.09 12:47 
hallo,

ich möchte bei meinem programm ein bearbeiten button einfügen, mit dem man die bestehenden einträge in der listview bearbeiten kann. alles funktioniert auch gut. bloß der button soll mit der eigenschaft enabled nur verfügbar sein, wenn auch ein objekt ausgewählt ist (hab ich mit dem ereignis SelectItem der listview hinbekommen); wie kann ich das dann machen, dass sobal kein eintrag mehr ausgewählt ist, der button wieder "unbrauchbar" wird??? weil sonst immer ein fehler erscheint, wenn man nix auswählt und der button bedient wird!

THX
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: Sa 01.08.09 12:54 
Du könntest prüfen, ob ListView1.Selected bzw. ListView1.ItemFocused nil ist - wenn ja, dann wurde kein Eintrag ausgewählt und du musst den Button deaktivieren. Diesen Code kannst du IMHO im Ereignis OnChagne einfügen.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 01.08.09 13:20 
Wurde OnSelectItem nicht auch ausgelöst, wenn der Eintrag wieder "entwählt" wurde? :gruebel:
Prüfst du dort, ob etwas markiert ist, oder blendest du den einfach immer ein?
Maisinator Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 167

Win XP HE SP3, Win Vista HP SP2
Delphi ;-)
BeitragVerfasst: Sa 01.08.09 13:23 
wenn ich es geprüft habe, blieb er immer enabled:= true;

aber funktioniert mit listview.selected! itemfocused funktioniert beim deaktievieren nicht!
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 01.08.09 14:02 
Ich hab grad mal geschaut, brauchst du doch alles gar nicht:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure TForm224.ListView1SelectItem(Sender: TObject; Item: TListItem;
  Selected: Boolean);
begin
  Button1.Enabled := Selected;
end;
Das wars schon... was meinst du wofür der Parameter Selected da ist? :roll:
Maisinator Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 167

Win XP HE SP3, Win Vista HP SP2
Delphi ;-)
BeitragVerfasst: Sa 01.08.09 14:25 
coool wusste ich nicht, werd ich sofort einbauen!