[traits] Button question...

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

[traits] Button question...

fred-2
Hi all,

Say I have a Button ">".

Action related to this button is going one step forward.

So, each time I click then relaease the button, I go forward one step.

Good.

But this may be too slow in some case.

Is it possible to detect that the button is still pressed, so I can go
forward one step until I release the button?


TIA


Cheers,

--
Fred
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: [traits] Button question...

Robert Kern
On Wed, Feb 16, 2011 at 7:00 AM, Fred <[hidden email]> wrote:

> Hi all,
>
> Say I have a Button ">".
>
> Action related to this button is going one step forward.
>
> So, each time I click then relaease the button, I go forward one step.
>
> Good.
>
> But this may be too slow in some case.
>
> Is it possible to detect that the button is still pressed, so I can go
> forward one step until I release the button?

Not with the plain ButtonEditor, no. You could make your own
ButtonEditor that does hook into the appropriate "pressed" toolkit
event which starts a timer until it gets "released".

--
Robert Kern
Enthought
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: [traits] Button question...

Brennan Williams
On 17/02/2011 6:07 a.m., Robert Kern wrote:

> On Wed, Feb 16, 2011 at 7:00 AM, Fred<[hidden email]>  wrote:
>> Hi all,
>>
>> Say I have a Button ">".
>>
>> Action related to this button is going one step forward.
>>
>> So, each time I click then relaease the button, I go forward one step.
>>
>> Good.
>>
>> But this may be too slow in some case.
>>
>> Is it possible to detect that the button is still pressed, so I can go
>> forward one step until I release the button?
> Not with the plain ButtonEditor, no. You could make your own
> ButtonEditor that does hook into the appropriate "pressed" toolkit
> event which starts a timer until it gets "released".
>
Does the slider in RangeEditor work this way? Might be an idea to look
at that code to see if it helps implement a special button.

Brennan

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: [traits] Button question...

Robert Kern
On Wed, Feb 16, 2011 at 12:49 PM, Brennan Williams
<[hidden email]> wrote:

> On 17/02/2011 6:07 a.m., Robert Kern wrote:
>> On Wed, Feb 16, 2011 at 7:00 AM, Fred<[hidden email]>  wrote:
>>> Hi all,
>>>
>>> Say I have a Button ">".
>>>
>>> Action related to this button is going one step forward.
>>>
>>> So, each time I click then relaease the button, I go forward one step.
>>>
>>> Good.
>>>
>>> But this may be too slow in some case.
>>>
>>> Is it possible to detect that the button is still pressed, so I can go
>>> forward one step until I release the button?
>> Not with the plain ButtonEditor, no. You could make your own
>> ButtonEditor that does hook into the appropriate "pressed" toolkit
>> event which starts a timer until it gets "released".
>>
> Does the slider in RangeEditor work this way? Might be an idea to look
> at that code to see if it helps implement a special button.

No. The slider widget typically simply emits an event whenever its
position changes. I don't think it would use a timer, but if it does,
it does so internally. Looking at the RangeEditor source won't help
any.

--
Robert Kern
Enthought
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: [traits] Button question...

bryce hendrix-2
In reply to this post by Brennan Williams
On Wed, Feb 16, 2011 at 12:49 PM, Brennan Williams <[hidden email]> wrote:
On 17/02/2011 6:07 a.m., Robert Kern wrote:
> On Wed, Feb 16, 2011 at 7:00 AM, Fred<[hidden email]>  wrote:
>> Hi all,
>>
>> Say I have a Button ">".
>>
>> Action related to this button is going one step forward.
>>
>> So, each time I click then relaease the button, I go forward one step.
>>
>> Good.
>>
>> But this may be too slow in some case.
>>
>> Is it possible to detect that the button is still pressed, so I can go
>> forward one step until I release the button?
> Not with the plain ButtonEditor, no. You could make your own
> ButtonEditor that does hook into the appropriate "pressed" toolkit
> event which starts a timer until it gets "released".
>
Does the slider in RangeEditor work this way? Might be an idea to look
at that code to see if it helps implement a special button.

Within wxwidgets, the spinner control may be implemented the same way, but its exposed as a EVT_SPINCTRL which is fired every time the value changes (via the spinner, via the text field its a EVT_TEXT event).

Bryce

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev