Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Problem with TListBox

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Mon Jul 09, 2007 2:00 pm    Post subject: Problem with TListBox Reply with quote

im making a media player and to try to figure out how to make a played songs list that you can click on and replay the song i did a code test




when i try to play a song on the list it takes the previous line and adds it

you can see this by the listbox1.items.add command

any ideas?

_________________
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Mon Jul 09, 2007 6:50 pm    Post subject: Reply with quote

You're trying to make clicking an item on the listbox pass whatever song you click to replay... but you're adding shit from the listbox itself to the listbox? Color me baffled as to exactly what you're tying to achieve.
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Mon Jul 09, 2007 9:22 pm    Post subject: Reply with quote

its a catch to see whats being applied to the MediaPlayer

if you look at the commented code you can see i was trying with the mediaplayer

_________________
Back to top
View user's profile Send private message
XTrinityX
Expert Cheater
Reputation: 0

Joined: 18 May 2006
Posts: 123
Location: Connecticut

PostPosted: Tue Jul 10, 2007 1:05 am    Post subject: Reply with quote

Now, I don't have delphi open, but I think what you are trying to achieve could be done with:

Code:
 mediaplayer1.url := listbox1.items[listbox1.selectedindex];
Back to top
View user's profile Send private message AIM Address
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue Jul 10, 2007 1:15 am    Post subject: Reply with quote

selectedIndex just returns a number I think.

selectedItem is what you're looking for.
Back to top
View user's profile Send private message
XTrinityX
Expert Cheater
Reputation: 0

Joined: 18 May 2006
Posts: 123
Location: Connecticut

PostPosted: Tue Jul 10, 2007 8:10 am    Post subject: Reply with quote

slovach wrote:
selectedIndex just returns a number I think.

selectedItem is what you're looking for.


Ya, it returns a number. When you do Listbox1.Items[number] , it returns the string at that number's index in the Listbox1.Items string array.

One thing though. I don't know whether Click events or Selected Index Changed events happen first. You may have to change the code to the Selected Index Changed events to get the correct index to return from Listbox1.SelectedIndex.
Back to top
View user's profile Send private message AIM Address
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Tue Jul 10, 2007 8:16 am    Post subject: Reply with quote

MediaPlayer1.URL := ListBox1.Items[ListBox1.selectedItem]

it cant find selectedItem identifier Rolling Eyes

_________________
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue Jul 10, 2007 8:56 am    Post subject: Reply with quote

listBox1.SelectedItem

or you could do it the SelectedIndex way above

e: is there a toString method kind of deal in delphi?
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Tue Jul 10, 2007 10:14 am    Post subject: Reply with quote

it doesnt give me that selection

wtfh

_________________
Back to top
View user's profile Send private message
XTrinityX
Expert Cheater
Reputation: 0

Joined: 18 May 2006
Posts: 123
Location: Connecticut

PostPosted: Tue Jul 10, 2007 10:46 am    Post subject: Reply with quote

its selectedindex not selecteditem...

MediaPlayer1.URL := Listbox1.Items[Listbox1.SelectedIndex];
Back to top
View user's profile Send private message AIM Address
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Tue Jul 10, 2007 10:52 am    Post subject: Reply with quote

i dont get that option

it wont compile

_________________
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue Jul 10, 2007 1:04 pm    Post subject: Reply with quote

XTrinityX wrote:
its selectedindex not selecteditem...


Both of them exist. :O
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites