Pisałem o tym w dziale newbie, ale nikt nie raczy mi odpisać. Może tutaj znajdę lepszą odpowiedź?
A teraz do sedna ;p
Wypociłem taki oto kodzik:
unit ProgressBar;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, StdCtrls, ComCtrls, Buttons, ExtCtrls,
WinTypes, WinProcs;
type
TProgressBarOWN = class(TProgressBar)
private
{ Private declarations }
protected
{ Protected declarations }
public
procedure MouseMove(Shift: TShiftState;
X, Y: Integer);
{ Public declarations }
published
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Samples', [TProgressBarOWN]);
end;
///////////////////////////////////////////////
procedure TProgressBarOWN.MouseMove(Shift: TShiftState;
X, Y: Integer);
var
newPosition : integer;
begin
if ssShift in Shift then
begin
Cursor := crHSplit;
newPosition := Round(x * Max / ClientWidth) ;
Position := newPosition;
end
else
begin
Cursor := crDefault;
end;
end;
//////////////////////////////////////////////////////
end.
Założenie jest takie, żeby utworzony progressbar można było regulować jak np. poziom głośności.
Miałem procedurkę dla progressbara w formie, ale chcę zaimplementować to bezpośrednio w komponent.
Innymi słowy chciałbym żeby po najechaniu myszką uaktywnił się event onmousemove, ale bez jakiegokolwiek pisania w programie.
Wszystko musi się znajdować w komponencie.
Co robię źle?