Recent

Author Topic: [SOLVED] ProgressBar mouse click  (Read 306 times)

Pe3s

  • Sr. Member
  • ****
  • Posts: 288
[SOLVED] ProgressBar mouse click
« on: September 30, 2022, 06:44:02 pm »
Hello, I am curious if I can write better progressbar control with the mouse ?
Code: Pascal  [Select][+][-]
  1. procedure TForm1.JvSpecialProgress1MouseDown(Sender: TObject;
  2.   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  3. begin
  4.   if Button = mbLeft then
  5.     begin
  6.       newPos := Round(X * JvSpecialProgress1.Maximum / JvSpecialProgress1.ClientWidth);
  7.     JvSpecialProgress1.Position := newPos;
  8. end;
  9. end;
  10.  
  11.  
« Last Edit: October 01, 2022, 09:49:33 am by Pe3s »

ASerge

  • Hero Member
  • *****
  • Posts: 2028
Re: ProgressBar mouse click
« Reply #1 on: October 01, 2022, 02:45:19 am »
Hello, I am curious if I can write better progressbar control with the mouse ?
In the general case Min + Round(X * (Max - Min) / Width).

Pe3s

  • Sr. Member
  • ****
  • Posts: 288
Re: ProgressBar mouse click
« Reply #2 on: October 01, 2022, 09:49:18 am »
Thank you  :)

 

TinyPortal © 2005-2018