I would like to know how to make my second mirror trackbar.position in the opposite direction of trackbar1.position. eg. The range is from 1 to 100.
So, when TrackBar1.Position := 2
, then trackbar2.Position := 99
No matter how the trackballs go, I would like to flip in the opposite direction.
Here is my code so far: (not interested in using keys for this), just mouse interaction.
Direction : string; Skip : boolean; procedure TForm1.TrackBar1Change(Sender: TObject); begin if TrackBar1.Position = TrackBar2.Position then begin if Direction = 'up' then TrackBar2.Position := TrackBar2.Position + 1; if Direction = 'down' then TrackBar2.Position := TrackBar2.Position - 1; skip := true; end; if TrackBar1.Position < TrackBar2.Position then begin if skip = false then begin TrackBar2.Position := TrackBar2.Position - 1; Direction := 'down'; end; end else begin if skip = false then begin TrackBar2.Position := TrackBar2.Position + 1; Direction := 'up'; end; end; end;
I'm probably overdoing it. Maybe there is an easier way. I prefer a simpler way. Thanks,
Ben
source share