Welcome to MacForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

getting live slider info

 
   Macintosh computer (Home) -> General Discussion RSS
Next:  bundle's resources no longer found  
Author Message
Howard1

External


Since: Sep 26, 2003
Posts: 53



(Msg. 1) Posted: Mon Jun 12, 2006 5:11 pm
Post subject: getting live slider info
Archived from groups: comp>sys>mac>programmer>misc (more info?)

Hi,

I'm having a great deal of trouble trying to update a text area with the
value from a slider as I move the slider. It should be so easy, but I've
spent half a day on it so far.

I've got a slider, set to respond "live", and a read-only text area, on
my window.

At first, I was using my window's carbon event handler to try to handle
the kEventControlIndicatorMoved event, but after some searching on the web,
I saw a post stating that that event needs to be handled by a handler on the
control, not the window. So, I added a control event handler, and sure
enough, I get the event there now.

BUT!... I'm not seeing the new value of the slider when I do this. If I
use GetControl32BitValue, I see the old value of the control, not the new
(live) value. If instead, I call GetEventParameter, passing
kEventParamControlValue, I get 0 (with an eventNotHandled return value, I
think).

So... how in the world do I get the "live" value of the slider, so that
I can update my text area with the value, as the slider is moved by the
used.

Thanks much,
-Howard

 >> Stay informed about: getting live slider info 
Back to top
Login to vote
Paul22

External


Since: Jun 25, 2004
Posts: 53



(Msg. 2) Posted: Mon Jun 12, 2006 7:32 pm
Post subject: Re: getting live slider info [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Howard" <alicebt.RemoveThis@hotmail.com> wrote in message
news:Nehjg.19237$mF2.8015@bgtnsc04-news.ops.worldnet.att.net...
> Hi,
>
> I'm having a great deal of trouble trying to update a text area with
the
> value from a slider as I move the slider. It should be so easy, but I've
> spent half a day on it so far.
>
> I've got a slider, set to respond "live", and a read-only text area,
on
> my window.
>
> At first, I was using my window's carbon event handler to try to
handle
> the kEventControlIndicatorMoved event, but after some searching on the
web,
> I saw a post stating that that event needs to be handled by a handler on
the
> control, not the window. So, I added a control event handler, and sure
> enough, I get the event there now.
>
> BUT!... I'm not seeing the new value of the slider when I do this. If
I
> use GetControl32BitValue, I see the old value of the control, not the new
> (live) value. If instead, I call GetEventParameter, passing
> kEventParamControlValue, I get 0 (with an eventNotHandled return value, I
> think).
>
> So... how in the world do I get the "live" value of the slider, so
that
> I can update my text area with the value, as the slider is moved by the
> used.
>

Have you tried directly getting the value of the slider when you get the
kEventControlIndicatorMoved ?

 >> Stay informed about: getting live slider info 
Back to top
Login to vote
Howard1

External


Since: Sep 26, 2003
Posts: 53



(Msg. 3) Posted: Mon Jun 12, 2006 7:39 pm
Post subject: Re: getting live slider info [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Paul" <remove_this_its_just_paul DeleteThis @patchdance.com> wrote in message
news:4jjjg.5094$lp.2636@newsread3.news.pas.earthlink.net...
>
> "Howard" <alicebt DeleteThis @hotmail.com> wrote in message
> news:Nehjg.19237$mF2.8015@bgtnsc04-news.ops.worldnet.att.net...
>> Hi,
>>
>> I'm having a great deal of trouble trying to update a text area with
> the
>> value from a slider as I move the slider. It should be so easy, but I've
>> spent half a day on it so far.
>>
>> I've got a slider, set to respond "live", and a read-only text area,
> on
>> my window.
>>
>> At first, I was using my window's carbon event handler to try to
> handle
>> the kEventControlIndicatorMoved event, but after some searching on the
> web,
>> I saw a post stating that that event needs to be handled by a handler on
> the
>> control, not the window. So, I added a control event handler, and sure
>> enough, I get the event there now.
>>
>> BUT!... I'm not seeing the new value of the slider when I do this.
>> If
> I
>> use GetControl32BitValue, I see the old value of the control, not the new
>> (live) value. If instead, I call GetEventParameter, passing
>> kEventParamControlValue, I get 0 (with an eventNotHandled return value, I
>> think).
>>
>> So... how in the world do I get the "live" value of the slider, so
> that
>> I can update my text area with the value, as the slider is moved by the
>> used.
>>
>
> Have you tried directly getting the value of the slider when you get the
> kEventControlIndicatorMoved ?
>
>

How can I do that, (other than with GetControl32BitValue, which I already
mentioned returns the _previous_ value)?

-Hward
 >> Stay informed about: getting live slider info 
Back to top
Login to vote
Howard1

External


Since: Sep 26, 2003
Posts: 53



(Msg. 4) Posted: Mon Jun 12, 2006 8:12 pm
Post subject: Re: getting live slider info [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Howard" <alicebt.RemoveThis@hotmail.com> wrote in message
news:Nehjg.19237$mF2.8015@bgtnsc04-news.ops.worldnet.att.net...
> Hi,
>
> I'm having a great deal of trouble trying to update a text area with
> the value from a slider as I move the slider. It should be so easy, but
> I've spent half a day on it so far.
>
> I've got a slider, set to respond "live", and a read-only text area, on
> my window.
>
> At first, I was using my window's carbon event handler to try to handle
> the kEventControlIndicatorMoved event, but after some searching on the
> web, I saw a post stating that that event needs to be handled by a handler
> on the control, not the window. So, I added a control event handler, and
> sure enough, I get the event there now.
>
> BUT!... I'm not seeing the new value of the slider when I do this. If
> I use GetControl32BitValue, I see the old value of the control, not the
> new (live) value. If instead, I call GetEventParameter, passing
> kEventParamControlValue, I get 0 (with an eventNotHandled return value, I
> think).

Actually, it's returning 0. (I was looking at a different variable in the
debugger)

>
> So... how in the world do I get the "live" value of the slider, so that
> I can update my text area with the value, as the slider is moved by the
> used.

That should be "user" (not "used")
 >> Stay informed about: getting live slider info 
Back to top
Login to vote
Paul22

External


Since: Jun 25, 2004
Posts: 53



(Msg. 5) Posted: Mon Jun 12, 2006 8:34 pm
Post subject: Re: getting live slider info [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Howard" <alicebt.TakeThisOut@hotmail.com> wrote in message
news:Bpjjg.19573$mF2.3322@bgtnsc04-news.ops.worldnet.att.net...
>
> "Paul" <remove_this_its_just_paul.TakeThisOut@patchdance.com> wrote in message
> news:4jjjg.5094$lp.2636@newsread3.news.pas.earthlink.net...
> >
> > "Howard" <alicebt.TakeThisOut@hotmail.com> wrote in message
> > news:Nehjg.19237$mF2.8015@bgtnsc04-news.ops.worldnet.att.net...
> >> Hi,
> >>
> >> I'm having a great deal of trouble trying to update a text area
with
> > the
> >> value from a slider as I move the slider. It should be so easy, but
I've
> >> spent half a day on it so far.
> >>
> >> I've got a slider, set to respond "live", and a read-only text
area,
> > on
> >> my window.
> >>
> >> At first, I was using my window's carbon event handler to try to
> > handle
> >> the kEventControlIndicatorMoved event, but after some searching on the
> > web,
> >> I saw a post stating that that event needs to be handled by a handler
on
> > the
> >> control, not the window. So, I added a control event handler, and sure
> >> enough, I get the event there now.
> >>
> >> BUT!... I'm not seeing the new value of the slider when I do this.
> >> If
> > I
> >> use GetControl32BitValue, I see the old value of the control, not the
new
> >> (live) value. If instead, I call GetEventParameter, passing
> >> kEventParamControlValue, I get 0 (with an eventNotHandled return value,
I
> >> think).
> >>
> >> So... how in the world do I get the "live" value of the slider, so
> > that
> >> I can update my text area with the value, as the slider is moved by the
> >> used.
> >>
> >
> > Have you tried directly getting the value of the slider when you get the
> > kEventControlIndicatorMoved ?
> >
> >
>
> How can I do that, (other than with GetControl32BitValue, which I already
> mentioned returns the _previous_ value)?
>
> -Hward




Duh. Not a Carbon expert, misread, never mind, sorry....

I suspect your slider may be running an internal event loop for tracking,
keeping state in local variables and not resyncing with the actual control
until it's done. I've seen that kind of thing w/ NSSliders: mouseDown()
doesn't return until mouse up, and mouseUp() is never called: works fine and
fast if you don't need live tracking, like the computers Cocoa was
originally designed for. Not sure how you'd work around this situation,
though.

Paul
 >> Stay informed about: getting live slider info 
Back to top
Login to vote
Howard1

External


Since: Sep 26, 2003
Posts: 53



(Msg. 6) Posted: Mon Jun 12, 2006 9:12 pm
Post subject: Re: getting live slider info [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Howard" <alicebt DeleteThis @hotmail.com> wrote in message
news:Nehjg.19237$mF2.8015@bgtnsc04-news.ops.worldnet.att.net...
> Hi,
>
> I'm having a great deal of trouble trying to update a text area with
> the value from a slider as I move the slider. It should be so easy, but
> I've spent half a day on it so far.
>
> I've got a slider, set to respond "live", and a read-only text area, on
> my window.
>
> At first, I was using my window's carbon event handler to try to handle
> the kEventControlIndicatorMoved event, but after some searching on the
> web, I saw a post stating that that event needs to be handled by a handler
> on the control, not the window. So, I added a control event handler, and
> sure enough, I get the event there now.
>
> BUT!... I'm not seeing the new value of the slider when I do this. If
> I use GetControl32BitValue, I see the old value of the control, not the
> new (live) value. If instead, I call GetEventParameter, passing
> kEventParamControlValue, I get 0 (with an eventNotHandled return value, I
> think).
>
> So... how in the world do I get the "live" value of the slider, so that
> I can update my text area with the value, as the slider is moved by the
> used.
>

What a lame system! The doc's say that a "live" control sends control
messages with the kEventControlIndicatorMoved, and it does (provided that
you set the handler for the control, not the window, which the doc's don't
tell you). But the "live" value isn't available if you do it that way!

The only way to do that which I can find (up to now, anyway) is to set up an
ActionProc, and use GetControlValue. So that's what I'm doing now, and it
works.

But I fail to see why kEventControlIndicatorMoved doesn't provide the "live"
information I need, since that's apparently why it exists in the first
place! Very strange...

-Howard
 >> Stay informed about: getting live slider info 
Back to top
Login to vote
Gregory Weston1

External


Since: Oct 03, 2004
Posts: 2984



(Msg. 7) Posted: Mon Jun 12, 2006 9:12 pm
Post subject: Re: getting live slider info [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <jNkjg.19781$mF2.17320@bgtnsc04-news.ops.worldnet.att.net>,
"Howard" <alicebt RemoveThis @hotmail.com> wrote:

> What a lame system!

Nope. Just a programmer who didn't read carefully enough. But that
happens to all of us from time to time.

> The doc's say that a "live" control sends control
> messages with the kEventControlIndicatorMoved, and it does (provided that
> you set the handler for the control, not the window, which the doc's don't
> tell you).

The docs _do_ tell you, though, that that event is intended to signal to
the control that it's time for it to redraw itself. Which somewhat
implies that it's the control that's intended to be the handler.

> But the "live" value isn't available if you do it that way!

The docs also say that the point of the message is to allow the control
to recalculate its own value based on the position of the indicator
(which _is_ provided). So, in fact, you're right: The live value isn't
updated because you've hooked into the system in a way that indicates
you'll be doing that update.


> The only way to do that which I can find (up to now, anyway) is to set up an
> ActionProc, and use GetControlValue. So that's what I'm doing now, and it
> works.
>
> But I fail to see why kEventControlIndicatorMoved doesn't provide the "live"
> information I need, since that's apparently why it exists in the first
> place! Very strange...

The ActionProc is the correct way for the client of a control to react
to manipulation of the control.

--
What I write is what I mean. I request that anyone who decides to respond
please refrain from "disagreeing" with something I didn't write in the first
place.
 >> Stay informed about: getting live slider info 
Back to top
Login to vote
Display posts from previous:   
   Macintosh computer (Home) -> General Discussion All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]