• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 160
  • 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

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

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