Solved

listbox click problem

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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 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.

707 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now