[MSEide-MSEgui-talk] About MSE TSlider.

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[MSEide-MSEgui-talk] About MSE TSlider.

fredvs
Hello Martin.

Sorry to come back with this but I did not catch how to fire a event when
the right button is released from the slider-button.

I want to assign a event only when the button is released.

I did try with this tslider.onsetvalue:

procedure tsongplayer2fo.changepos(const Sender: TObject; var avalue:
realty; var accept: boolean);
begin
  if accept then
    uos_InputSeek(theplayer, Inputindex, trunc(avalue * Inputlen));
 end;

But that way, "accept" is always true, even when the button is not released.

Thanks.

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] About MSE TSlider.

mse
Administrator
On Sunday 01 October 2017 12:26:19 fredvs wrote:

>
> I want to assign a event only when the button is released.
>
> I did try with this tslider.onsetvalue:
>
> procedure tsongplayer2fo.changepos(const Sender: TObject; var avalue:
> realty; var accept: boolean);
> begin
>   if accept then
>     uos_InputSeek(theplayer, Inputindex, trunc(avalue * Inputlen));
>  end;
>
> But that way, "accept" is always true, even when the button is not
> released.
>
The purpose of "accept" is to reject a value. Set it to false if you don't
accept the value.
Right button click is normally used to show a popup menu.
It is possible to "preview" all mouse messages by tform.onchildmouseevent,
check for
"
(sender = <theslider>) and (ainfo.eventkind = ek_buttonrelease) and
(ainfo.button = mb_right);
"
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] About MSE TSlider.

mse
Administrator
In reply to this post by fredvs
On Sunday 01 October 2017 12:26:19 fredvs wrote:
> Hello Martin.
>
> Sorry to come back with this but I did not catch how to fire a event when
> the right button is released from the slider-button.
>
> I want to assign a event only when the button is released.
>
For left button disable tslider.options.sbo_thumbtrack.

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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] About MSE TSlider.

fredvs
In reply to this post by mse
> The purpose of "accept" is to reject a value. Set it to false if you don't
accept the value.

Sorry, I still do not catch ;-(

Concretely, what must I change in code ?

What Tslider event?

And ainfo.eventkind = ek_buttonrelease, what Tslider event gives ainfo data?

Thanks.

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] About MSE TSlider.

mse
Administrator
On Sunday 01 October 2017 17:45:33 fredvs wrote:
> > The purpose of "accept" is to reject a value. Set it to false if you
> > don't
>
> accept the value.
>
> Sorry, I still do not catch ;-(
>
And I don^t understand what you want to achieve. :-)
Please explain the goal.

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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] About MSE TSlider.

fredvs
> >Sorry, I still do not catch ;-(
> And I don^t understand what you want to achieve

OK, we are both then. :-).

Imagine that a song is playing.

So the audio thread sent, at each reading of the buffer, some data to the
main thread, like position in the sound.

Then there is a synchro: the button slider is set at the position given by
the audio thread.

If  I change the position manually while the song is playing, now, the
position is changed everytime while moving the slider-button.

It is not what I want, I would prefer that the position change only when I
release the button, and when the button is not released, only calculate the
"virtual position" and give it in the label-position..

(and it is why I did a "custom" TSlider with some public mouse-event that
you did not like).

I hope you did understand.

Fre;D




--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] About MSE TSlider.

mse
Administrator
On Monday 02 October 2017 15:44:32 fredvs wrote:

> > >Sorry, I still do not catch ;-(
> >
> > And I don^t understand what you want to achieve
>
> OK, we are both then. :-).
>
> Imagine that a song is playing.
>
> So the audio thread sent, at each reading of the buffer, some data to the
> main thread, like position in the sound.
>
> Then there is a synchro: the button slider is set at the position given by
> the audio thread.
>
> If  I change the position manually while the song is playing, now, the
> position is changed everytime while moving the slider-button.
>
> It is not what I want, I would prefer that the position change only when I
> release the button, and when the button is not released, only calculate the
> "virtual position" and give it in the label-position..
>
Use tslider.scrollbar.onafterevent and
"
procedure tmainfo.aftereventev(const sender: tcustomscrollbar;
               const akind: scrolleventty; const avalue: Real);
begin
 if akind = sbe_thumbposition then begin
  <songposition>:= sender.value;
 end
 else begin
  <labeldisp>.value:= sender.value;
 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] About MSE TSlider.

mse
Administrator
On Monday 02 October 2017 16:23:20 Martin Schreiber wrote:

>
> Use tslider.scrollbar.onafterevent and
> "
> procedure tmainfo.aftereventev(const sender: tcustomscrollbar;
>                const akind: scrolleventty; const avalue: Real);
> begin
>  if akind = sbe_thumbposition then begin
>   <songposition>:= sender.value;
>  end
>  else begin
>   <labeldisp>.value:= sender.value;
>  end;
> end;
> "
>
or better
"
procedure tmainfo.aftereventev(const sender: tcustomscrollbar;
               const akind: scrolleventty; const avalue: Real);
begin
 <labeldisp>.value:= sender.value;
 if akind = sbe_thumbposition then begin
  <songposition>:= sender.value;
 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] About MSE TSlider.

fredvs
> or better

Huh, to not loose the last position in the tlabel ?

Yes, but it is done just after button is released by the audio thread.

But ok, it is better ;-)

Now the test:

Perfect, smooth, direct, no delay, no "scratch".

So, this works perfectly:

- audio thread event to TSlider:
 
 if not TrackBar.clicked then  <labeldisp>.value:= sender.value;

- user event using  TSlider:

 <labeldisp>.value:= sender.value;
 if akind = sbe_thumbposition then   <songposition>:= sender.value;

Many thanks Martin.

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk