comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Changing WIDGET_BUTTON behaviour
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Changing WIDGET_BUTTON behaviour [message #62448] Tue, 09 September 2008 08:57
Spon is currently offline  Spon
Messages: 178
Registered: September 2007
Senior Member
On Sep 9, 3:16 pm, Thiago Biscaro <tsbisc...@gmail.com> wrote:
> There's 2 ways of pressing a button created by the WIDGET_BUTTON
> method: pressing spacebar, or clicking with any mouse button.
>
> Is there a way to activate the button using the enter (carriage
> return) key? It's really annoying and counterintuitive not have this
> functionality implemented.

Short of building your own 'pseudobuttons' out of draw widgets, I
don't see a simple way of implementing this, as button widgets do not
accept the Keyboard_Events keyword.

After having prodded it myself for a while, I had a trawl through
David's site and it threw up this:
http://www.dfanning.com/widget_tips/keyboard_events.html
which may be more useful.

Regards,
Chris

; Here's how I went about it:
PRO PSEUDOBUTTON_PRESS
PRINT, 'Button has been pressed!'
END

PRO PSEUDOBUTTON_EVENT, Event
; Mouse click press
IF Event.Type EQ 0 $
; Keyboard event
OR (Event.Type EQ 5 $
; Enter key
AND Event.Ch EQ 13 $
; Pressed, not released
AND Event.Press) $
THEN PSEUDOBUTTON_PRESS
END

PRO PSEUDOBUTTON
TLB = WIDGET_BASE(COLUMN = 1)
BTN = WIDGET_DRAW(TLB, /BUTTON_EVENTS, $
KEYBOARD_EVENTS = 1)
WIDGET_CONTROL, TLB, /REALIZE
WIDGET_CONTROL, BTN, GET_VALUE = WIndex
WSET, WIndex
XYOUTS, 0.1, 0.1, 'Button'
XMANAGER, 'PSEUDOBUTTON', TLB
END
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: ENVI on Fedora Core 9 in VMware virtual machine
Next Topic: Re: Weiler Atherton Clipping Algorithm

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:56:52 PDT 2025

Total time taken to generate the page: 0.00516 seconds