Solved

listbox click problem

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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

636 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