0
0

Hi
I think this is a very simple question.

I wanna set the current position of a mp3 file, but I wanna that the value changes only when I leave the trackbar. I tried using all the events of trackbar, but without success. Any suggestion?

Thanks in advance

cmstein

  • You must to post comments
0
0

You are able to expose the OnMouseUp event by declaring your own TTrackBar descendant. Here is an example.
[code:3h13kytz]
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls;

type
TMyTrackBar = class(TTrackBar)
published
{ Raise the visibility of the OnMouseUp event that is
declared in TControl }
property OnMouseUp;
end;

TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
FTrackBar: TMyTrackBar;
procedure FTrackBarMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
FTrackBar := TMyTrackBar.Create(nil);
FTrackBar.Parent := Self;
FTrackBar.OnMouseUp := FTrackBarMouseUp;
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
FTrackBar.Free;
end;

procedure TForm1.FTrackBarMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Caption := Format(’Position = %d’, [FTrackBar.Position]);
end;

end.
[/code:3h13kytz]

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.