Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

listbox click problem

Posted on 2001-07-12
5
Medium Priority
?
368 Views
Last Modified: 2008-03-17
I'm trying to create a playlist for a mediaplayer I'm writing in Borland c++ builder 3.

Here's the code i've written:

void __fastcall TMainForm::PlayListDblClick(TObject *Sender)
{
for (int i = 0; i < PlayList->Items->Count; i++)// this where i think i'm wrong.
{
MediaPlayer1->FileName = PlayList->Items->Strings[i].c_str();
MediaPlayer1->Open();
    MediaPlayer1->Play();
    TrackBar1->Max = MediaPlayer1->Length;
    MainForm->Caption = "Visual Player: " +
ExtractFileName(MediaPlayer1->FileName);
    Timer1->Enabled = true;
}
}

as you can see the code will go down the list till it gets to the last entry then plays that entry.
i need it to play the item the user Dubble clicks on and not the last entry in the list. playlist is the listbox from borlands vcl.

Thanks for any help.
Gary C.
0
Comment
Question by:GaryCrowhurst
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 6279465
see jukebox apps from
http://www.geocities.com/SiliconValley/Campus/4650/componentes/comp07.html
as an example of using PlayList and
http://math.nmu.edu/~trak/gamedev/midi_bldr5.html
as other example (but for bcb5!).
0
 
LVL 1

Accepted Solution

by:
kuchnaheen earned 400 total points
ID: 6281956
PlayListDblClicked()
{
      int index=0;
      int len=0;

      //for getting the list item text
      //u can also use simple chacter string here
      CString ListItem;

      //get the index of item i.e dbl clicked
      index=m_PlayList .GetCurSel ();

      //get the length of the item
      len=m_PlayList.GetTextLen (index);

       //finally get the text of the item
     m_PlayList.GetText (index,ListItem.GetBuffer (len));
      ListItem.ReleaseBuffer ();

     MediaPlayer1->FileName =ListItem;
     ///do what ever u want with the list item
     ........
}

simply try to find compatible functions in ur compiler

regds

kuchnaheen
0
 
LVL 1

Expert Comment

by:kuchnaheen
ID: 6281957
that is what i do to track the listbox item text in VC++ 6.0...u can do the same...just find the compatible functionality for ur compiler
0
 
LVL 11

Expert Comment

by:griessh
ID: 6828222
I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. Unless there is objection or further activity,  I will suggest to accept "kuchnaheen" comment(s) as an answer.

If you think your question was not answered at all, you can post a request in Community support (please include this link) to refund your points.
The link to the Community Support area is: http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0
 
LVL 1

Expert Comment

by:Computer101
ID: 6845913
Comment from kuchnaheen accepted as answer.

Thank you
Computer101
Community Support Moderator
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question