Hello Martin.

OK, I will (try to) understand all your advices.


Write you later.


Fre;D

________________________________
De : Martin Schreiber <mse00...@gmail.com>
Envoyé : samedi 15 juillet 2017 08:26
À : mseide-msegui-talk@lists.sourceforge.net
Objet : Re: [MSEide-MSEgui-talk] TSlider and onmouseevent/onkeydown/onkeyup ?

On Friday 14 July 2017 18:21:16 Fred van Stappen wrote:
>
> Other thing...
>
> When manually changing the position of the slider, how to get the position
> of the slider before to release the mouse-button ?
>
> I did try with Tslider.onchange but the position does not change until the
> button is released.
>
All MSEgui editwidgets (including tslider) have the
properties "onsetvalue", "ondataentered" and "onchange".
"onsetvalue" will be called when the user enters a value. In case of tslider
the signature is
"
procedure tmainfo.slidersetvalev(const sender: TObject; var avalue: realty;
               var accept: Boolean);
"
"avalue" is the new value, "<tslider>.value" still has the old value. Here the
new value can be changed by changing "avalue" or be rejected by
setting "accept" to false.
If the new value has been accepted <tslider.value>  will be set to the new
value and "ondataentered" will be called. "ondataentered" has the signature
"
procedure tmainfo.sliderdatentev(const sender: TObject);
"
"onchange" will be called when the "value" changes. "onchange" has the
signature
"
procedure tmainfo.sliderchangeev(const sender: TObject);
"
In order to trigger value settings before releasing the mouse button activate
<tslider>.scrollbar.options sbo_thumbtrack (default true).

I do not like to publish mouse events because this events are used internally
by tslider and are not intended to be used by the component users.

For the the problem with the thread I would do
"
procedure tmainfo.threadexeev(const sender: tthreadcomp);
var
 val1: realty;
begin
 val1:= 0;
 while true do begin
  sleep(100);
  if sender.terminated then begin
   break;
  end;
  val1:= val1 + 0.01;
  if val1 > 1.001 then begin
   break;
  end;
  try
   application.lock();
   if not tslider1.clicked then begin
    tslider1.value:= val1;
   end;
  finally
   application.unlock();
  end;
 end;
end;

"
Martin

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to