Solved

listbox click problem

Posted on 2001-07-12
5
362 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 100 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
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 learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

710 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