Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Greetings all.... This is a toug

Status
Not open for further replies.

801119

Programmer
Apr 10, 2000
311
SE
Greetings all....

This is a tough thing for me to explain...
I have this code

Code:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
 move_it(1,ListBox1);
}
void __fastcall TForm1::move_it(int Direction[1],TObject *Sender)
{
 int curPos = Sender->ItemIndex,newPos=0;
 if( Direction == 0 )
         {
          newPos = curPos-1;
         }
 else if( Direction == 1 )
         {
          newPos = curPos+1;
         }
 if( newPos<0 ) newPos = (Sender->Items->Count-1);
 else if( newPos==Sender->Items->Count ) newPos = 0;
 Sender->Items->Move(curPos,newPos);
 Sender->ItemIndex = newPos;
}

But it does not work as I want it to... When I call move_it(...) I want the selected item in a TListBox to be moved, eithere up or down.. the problem is how do I send a Component name to the move_it function?? I know that TObject *Sender do not work, but what am I supposed do use?
That is, when I call move_it(1,ListBox1) I want to move an item in ListBox1, and when i use move_it(1,ListBox2) I want to move an item in ListBox2... and so on!

Any one got any idea?? Lord and allmighty ruler over Aysilon!
Also pro in stupid code programing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top