• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 165
  • Last Modified:

How to have my Listboxes cooperate?

Hi Folks!

I have 2 Listboxes. Each is filled with files. When I select the Nth item of Listbox1 I want that action to select the Nth item of Listbox2 as well.
I need both files to be selected simultaneously cause my procedure depends on both files. Now I numbered all files from 01 to 18 to make things easier, I thought but I have been wrong.

Regards,

Peter

P.W.S.D.T.T.F.T.O.Y.W.D.K.M.Y.I.W.K.R.T.B.H.I.W.B.N.A.S.I.T.N.F:)

(ProvidingWorkingSampleDoesTheTrickForThoseOfYouWhoDontKnowMeYetIWillKeepRepeatingThisButHopefullyItWontBeNecessaryAnymore
SomewhereInTheNearbyFuture:))
0
PeterdeB
Asked:
PeterdeB
  • 2
1 Solution
 
kretzschmarCommented:
use the onclick or onChange-event (no delphi on hand yet)

..
if sender = ListBox1 then
  ListBox2.itemIndex := ListBox1.ItemIndex
else
  ListBox1.itemIndex := ListBox2.ItemIndex;
...

just from head, means not tested and typos possible

meikl ;-)
0
 
GTwoDCommented:
What do you want to happen if listbox2 is clicked?
0
 
kretzschmarCommented:
>What do you want to happen if listbox2 is clicked?

must explain my suggestion  :-)
the described eventhandling is thought to assign it to both listboxes,
so it shouldn't matter which box was clicked

meikl ;-)
0
 
PeterdeBAuthor Commented:
Solved!Tnx!

Regards Peter

(I set it to the onchange event btw since the onclick didnt feel like cooperating :))
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now