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



BeitragVerfasst: Sa 03.05.03 17:08 
ausblenden Quelltext
1:
2:
3:
If not Listbox1.OnClick;
       then
         Showmessage('Bitte wählt eine Music Datei aus');


Also ich wollte wenn ListBox nict geklickt ist soll er eine showmesaage anzeigen!!

Was mach ich den nur Falsch!!
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Sa 03.05.03 17:12 
OnClick ist ein Ereignis und kann also nicht als Bool'scher Wert ausgewertet werden. In den FAQs gibt es einen Beitrag über IF-THEN-ELSE den solltest Du Dir mal durchlesen. (Hatte ich Dir das nicht schon gesagt, oder war das jemand anders?)

Was Du brauchst ist "if ListBox1.ItemIndx=-1 then" und hinter dem Bool'schen Ausdruck in einer IF-Anweisung kommt auch kein Semikolon, ist ja keine Anweisung.

//edit: ja, Dich hatte ich schon mal auf den Beitrag aufmerksam gemacht

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
Starfighter Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Sa 03.05.03 17:21 
ja ich wieß danke nochmal Peter.
Starfighter Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Sa 03.05.03 17:25 
ausblenden Quelltext
1:
2:
If not Listbox1.ItemIndex = -1 then
         Showmessage('Bitte wählt eine Music Datei aus');


Ist dsa so richtig nur er reagiert nicht, wenn ich den Button einfach so klicke ohne in der listbox zuklicken!!!
BungeeBug
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 901



BeitragVerfasst: Sa 03.05.03 17:30 
Hi,
das "not" muss in dem Fall weg! Sonst zeigt er immer die Message an wenn der wert <> -1 (nichts angewählt) ist.

MfG BungeeBug
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Sa 03.05.03 17:32 
Du hast da ein "not" reingeschummelt, das gehört da nicht hin. Schau Dir mal die Eigenschaft ItemIndex in der Hilfe an, dann wirst Du sehen, weshalb!

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
BungeeBug
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 901



BeitragVerfasst: Sa 03.05.03 17:34 
@Peter zulangsam :)

MfG Bungee *freutsichdasermalwiederschnellerwar*
Starfighter Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Sa 03.05.03 17:36 
wie mach ich das den sonst?
Wenn es mit If not net geht
BungeeBug
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 901



BeitragVerfasst: Sa 03.05.03 17:39 
Überlegen wie mans anders machen kann :) ... es gibt leider selten DIE Lösung die man nehmen kann ...

MfG BungeeBug
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Sa 03.05.03 17:42 
@Starfighter: wenn ich schreibe, Du hast da ein "not" reingeschummelt, wie wäre es, das "not" einfach mal wegzulassen?

BungeeBug hat folgendes geschrieben:
@Peter zulangsam
Och, Menno :schmoll:

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
Starfighter Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Sa 03.05.03 20:19 
Juhu ich hab es endlich.. :)

ausblenden Quelltext
1:
2:
3:
4:
5:
     If Listbox1.ItemIndex = -1
       then
        Showmessage('Bitte wählen Sie eine Music-Datei aus!')     // Anzeigen wenn keine Music datei vorhanden bzw angeklickt wurde..!!
           else
            Timer2.Enabled := false ;
foxy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 814

Ubuntu, Gentoo
C++, PHP, Java, Ruby, Perl (Eclipse)
BeitragVerfasst: Mo 05.05.03 13:21 
du kannst das ganze natürlich auch machen mit case ... of wenn du mehrere abfragen hast bsp. index 1,2,3,4,5,6,7
dann müsstest du 7 if abfragen mach = unsinn also macht man case of ;)

nur son kleiner tipp

_________________
"Only wimps use tape backup: real men just upload their important stuff on ftp, and let the rest of the world mirror it." (Linus Torvalds)
OperatingSystem Laptop (Ubuntu Hardy)