Re: [wxhaskell-users] Controlling keyboard events

2007-11-21 Thread Andrew Butterfield
shelarcy wrote:
> Hi Andrew,
>
> I'm sorry about my reply is late.
> Do you already solve this problem?
>
> On Thu, 08 Nov 2007 18:23:40 +0900, Andrew Butterfield <[EMAIL PROTECTED]> 
> wrote:
>   
>> My code - for the relevant windows
>>
>>  >   -- Goal Window
>>  >   gp <- panel h []
>>  >   g <- scrolledWindow gp []
>>
>> Do I need to nest another window inside the scrolled window ?
>> When I perform the right-arrow action (say), I repaint g,
>> which renders the expression appropriately.
>> 
>
> Is gp a panel?
>
> I don't know why you don't want to set key events for panel
> instead of scrolledWindow. I think you can skip key events
> for scrolledWindow by propagateEvent, if you set key events
> for panel.
>   
OK - I see what you mean - I thought that as I had to paint to g that I 
needed to catch keystrokes
there - but of course these are independent of the painting - so I see 
what you are suggesting.


I solved the problem in a different way - I started experimenting in 
another window and discovered
the following.

If, in g (above) I handle arrow keys with individual handler like so:
 
set g [ on downKey :=   ; on upKey := ... ... ]

then hitting the down-arrow keys triggers my handler and that for the 
scrollbars.

However if I set a single handler for all keys which
then does a case analysis of keys, as follows:,
then the scroll bars are not affected by the arrow keys.

set g [ on anyKey := handleKeys ... ]

handleKeys ... k
 = case k of
  KeyDown -> 
  KeyUp -> ...


-- 

Andrew Butterfield Tel: +353-1-896-2517 Fax: +353-1-677-2204
Foundations and Methods Research Group Director.
Course Director, B.A. (Mod.) in CS and ICT degrees, Year 4.
Department of Computer Science, Room F.13, O'Reilly Institute,
Trinity College, University of Dublin, Ireland.
http://www.cs.tcd.ie/Andrew.Butterfield/



-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
wxhaskell-users mailing list
wxhaskell-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxhaskell-users


Re: [wxhaskell-users] Controlling keyboard events

2007-11-20 Thread shelarcy
Hi Andrew,

I'm sorry about my reply is late.
Do you already solve this problem?

On Thu, 08 Nov 2007 18:23:40 +0900, Andrew Butterfield <[EMAIL PROTECTED]> 
wrote:
> My code - for the relevant windows
>
>  >   -- Goal Window
>  >   gp <- panel h []
>  >   g <- scrolledWindow gp []
>
> Do I need to nest another window inside the scrolled window ?
> When I perform the right-arrow action (say), I repaint g,
> which renders the expression appropriately.

Is gp a panel?

I don't know why you don't want to set key events for panel
instead of scrolledWindow. I think you can skip key events
for scrolledWindow by propagateEvent, if you set key events
for panel.

> My biggest problem is that the documentation is very unclear.

I think problems come from poor examples.

Can you send us more complete - executable - example code?
Your problem is unclear for me.


Best Regards,

-- 
shelarcy 
http://page.freett.com/shelarcy/

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
wxhaskell-users mailing list
wxhaskell-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxhaskell-users


Re: [wxhaskell-users] Controlling keyboard events

2007-11-08 Thread Andrew Butterfield
shelarcy wrote:
> Hi Andrew,
>
> On Wed, 07 Nov 2007 21:39:44 +0900, Andrew Butterfield <[EMAIL PROTECTED]> 
> wrote:
>   
>> However when I hit an arrow key, the expression navigation works fine,
>> but the scrolled window also moves !
>>
>> How do I stop these key events getting to the scrollbars ?
>>
>> (I only want to scroll using the mouse.)
>>
>> The wxWidgets documents talk about preventing event propagation
>> using wxEvent::Skip, but I can't find a wxHaskell equivalent of this.
>> 
>
> wxHaskell has propagateEvent function that is wrapper function of 
> wxEvent::Skip.
> How about use it?
>
> http://wxhaskell.sourceforge.net/doc/Graphics.UI.WX.Events.html#v%3ApropagateEvent
>   
because it says:

*propagateEvent* :: IO ()
Pass the event on the next /wxWindows/ event handler, either on this 
window or its parent. Always call this method when you do not process 
the event. (This function just call skipCurrentEvent 
).
 



I want to do the opposite - handle the event in the frame where the 
expression is displayed,
but not send it to whatever is handling the scroll bars

My code - for the relevant windows

 >   -- Goal Window
 >   gp <- panel h []
 >   g <- scrolledWindow gp []

Do I need to nest another window inside the scrolled window ?
When I perform the right-arrow action (say), I repaint g,
which renders the expression appropriately.

My biggest problem is that the documentation is very unclear.

-- 

Andrew Butterfield Tel: +353-1-896-2517 Fax: +353-1-677-2204
Foundations and Methods Research Group Director.
Course Director, B.A. (Mod.) in CS and ICT degrees, Year 4.
Department of Computer Science, Room F.13, O'Reilly Institute,
Trinity College, University of Dublin, Ireland.
http://www.cs.tcd.ie/Andrew.Butterfield/



-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
wxhaskell-users mailing list
wxhaskell-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxhaskell-users


Re: [wxhaskell-users] Controlling keyboard events

2007-11-08 Thread shelarcy
Hi Andrew,

On Wed, 07 Nov 2007 21:39:44 +0900, Andrew Butterfield <[EMAIL PROTECTED]> 
wrote:
> However when I hit an arrow key, the expression navigation works fine,
> but the scrolled window also moves !
>
> How do I stop these key events getting to the scrollbars ?
>
> (I only want to scroll using the mouse.)
>
> The wxWidgets documents talk about preventing event propagation
> using wxEvent::Skip, but I can't find a wxHaskell equivalent of this.

wxHaskell has propagateEvent function that is wrapper function of wxEvent::Skip.
How about use it?

http://wxhaskell.sourceforge.net/doc/Graphics.UI.WX.Events.html#v%3ApropagateEvent


Best Regards,

-- 
shelarcy 
http://page.freett.com/shelarcy/

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
wxhaskell-users mailing list
wxhaskell-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxhaskell-users


[wxhaskell-users] Controlling keyboard events

2007-11-07 Thread Andrew Butterfield
I have an application where I want to use the up/down/left/right
arrow keys to navigate around an expression displayed on-screen.

I also want the window to have scrollbars.

However when I hit an arrow key, the expression navigation works fine,
but the scrolled window also moves !

How do I stop these key events getting to the scrollbars ?

(I only want to scroll using the mouse.)

The wxWidgets documents talk about preventing event propagation
using wxEvent::Skip, but I can't find a wxHaskell equivalent of this.

-- 

Andrew Butterfield Tel: +353-1-896-2517 Fax: +353-1-677-2204
Foundations and Methods Research Group Director.
Course Director, B.A. (Mod.) in CS and ICT degrees, Year 4.
Department of Computer Science, Room F.13, O'Reilly Institute,
Trinity College, University of Dublin, Ireland.
http://www.cs.tcd.ie/Andrew.Butterfield/



-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
wxhaskell-users mailing list
wxhaskell-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxhaskell-users