Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

listbox click problem

Posted on 2001-07-12
5
Medium Priority
?
373 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
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
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. …
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.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

782 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