shelarcy | 2 Sep 14:46 2007
Picon

Re: is imageCreateFromPixelArray "safe"?

Hi Conal,

On Wed, 29 Aug 2007 09:42:15 +0900, Conal Elliott <conal@...> wrote:
> Is there any reason for imageCreateFromPixelArray to be in IO?  I want to
> use it as a pure function (via unsafePerformIO), and I'm wondering if there
> are any gotchas.   - Conal

I think it's just implementation reason.

imageCreateFromPixelArray create pixelBuffer and set pixelBuffer
color interanally, and then create image by pixelBuffer.

imageCreateFromPixelArray :: Array Point Color -> IO (Image ())
imageCreateFromPixelArray pixels
   = let (Point x y) = snd (bounds pixels)
     in imageCreateFromPixels (sz (x+1) (y+1)) (elems pixels)

imageCreateFromPixels :: Size -> [Color] -> IO (Image ())
imageCreateFromPixels size colors
   = do pb <- pixelBufferCreate size
        pixelBufferSetPixels pb colors
        imageCreateFromPixelBuffer pb   -- image deletes pixel buffer

http://darcs.haskell.org/wxhaskell/wxcore/src/Graphics/UI/WXCore/Image.hs

So I think we can use this function as a safe one.

Best Regards,

--

-- 
(Continue reading)

Conal Elliott | 4 Sep 15:49 2007
Picon

Re: is imageCreateFromPixelArray "safe"?

Thanks.  I'm using the function as pure, and so far, so good.  Cheers,  - Conal

On 9/2/07, shelarcy <shelarcy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > wrote:
Hi Conal,

On Wed, 29 Aug 2007 09:42:15 +0900, Conal Elliott < conal-R2YG1wQAgWFeoWH0uzbU5w@public.gmane.org> wrote:
> Is there any reason for imageCreateFromPixelArray to be in IO?  I want to
> use it as a pure function (via unsafePerformIO), and I'm wondering if there
> are any gotchas.   - Conal

I think it's just implementation reason.

imageCreateFromPixelArray create pixelBuffer and set pixelBuffer
color interanally, and then create image by pixelBuffer.


imageCreateFromPixelArray :: Array Point Color -> IO (Image ())
imageCreateFromPixelArray pixels
   = let (Point x y) = snd (bounds pixels)
     in imageCreateFromPixels (sz (x+1) (y+1)) (elems pixels)

imageCreateFromPixels :: Size -> [Color] -> IO (Image ())
imageCreateFromPixels size colors
   = do pb <- pixelBufferCreate size
        pixelBufferSetPixels pb colors
        imageCreateFromPixelBuffer pb   -- image deletes pixel buffer

http://darcs.haskell.org/wxhaskell/wxcore/src/Graphics/UI/WXCore/Image.hs


So I think we can use this function as a safe one.

Best Regards,

--
shelarcy <shelarcy    hotmail.co.jp>
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/
-------------------------------------------------------------------------
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/
Conal Elliott | 4 Sep 15:55 2007
Picon

crashing bug/feature: poking at closed frames

I had a crashing bug in the new version of Eros I'm working on.  It turned out that my event call-backs were still poking state in closed frames (MDI children).  While I knew I'd have some wasted work, I didn't expect the crash.  I've solved / worked-around the problem now, by having the frames become invisible instead of closing them.  What I'd rather do is have them reclaimed by a finalizer during GC.

Anyway, is this crashing behavior a known issue?

Cheers,   - Conal

-------------------------------------------------------------------------
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/
-------------------------------------------------------------------------
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/
Conal Elliott | 4 Sep 18:37 2007
Picon

setting button size

I want to resize my button control to be square.  I tried "set ctl [ size := Size 100 100]" with no visible effect.  Same with clientSize & outerSize.  Does anyone know the required magic?   Thanks.  - Conal

-------------------------------------------------------------------------
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/
-------------------------------------------------------------------------
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/
Conal Elliott | 6 Sep 22:54 2007
Picon

Re: setting button size

No solution yet.  Here's a simple program illustrating the problem.  Any ideas?

    import Graphics.UI.WX

    runUI1  ::  IO ()
    runUI1  = start $
      do  f   <- frame [ ]
          pan <- panel f  []
          b   <- button pan [ text := "B!", size := Size 50 50 ]
          set pan  [ layout := widget b ]
          set f    [ layout := widget pan ]

Thanks,  - Conal

On 9/4/07, Conal Elliott <conal-R2YG1wQAgWFeoWH0uzbU5w@public.gmane.org> wrote:
I want to resize my button control to be square.  I tried "set ctl [ size := Size 100 100]" with no visible effect.  Same with clientSize & outerSize.  Does anyone know the required magic?   Thanks.  - Conal

-------------------------------------------------------------------------
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/
-------------------------------------------------------------------------
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/
Mads Lindstrøm | 7 Sep 17:41 2007
Picon

Re: setting button size

Hi Conal

Conal Elliott:
> import Graphics.UI.WX
> 
>     runUI1  ::  IO ()
>     runUI1  = start $
>       do  f   <- frame [ ]
>           pan <- panel f  [] 
>           b   <- button pan [ text := "B!", size := Size 50 50 ]
>           set pan  [ layout := widget b ]
>           set f    [ layout := widget pan ] 

On my computer it is square. I am running Debian Linux with gtk as a
backend. Maybe it has something to do with your backend or WxHaskell's
binding to the backend.

I also tried with size (150,150) and still square (but bigger). I tried
with (450,150) and it was not square (as expected).

Greetings,

Mads Lindstrøm

-------------------------------------------------------------------------
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/
Conal Elliott | 7 Sep 19:17 2007
Picon

Re: setting button size

Thanks, Mads.  I guess it's another Windows problem then.  Glad to know.   - Conal

On 9/7/07, Mads Lindstrøm < mads_lindstroem-KK7TH6PgNEI@public.gmane.org> wrote:
Hi Conal

Conal Elliott:
> import Graphics.UI.WX
>
>     runUI1  ::  IO ()
>     runUI1  = start $
>       do  f   <- frame [ ]
>           pan <- panel f  []
>           b   <- button pan [ text := "B!", size := Size 50 50 ]
>           set pan  [ layout := widget b ]
>           set f    [ layout := widget pan ]

On my computer it is square. I am running Debian Linux with gtk as a
backend. Maybe it has something to do with your backend or WxHaskell's
binding to the backend.

I also tried with size (150,150) and still square (but bigger). I tried
with (450,150) and it was not square (as expected).

Greetings,

Mads Lindstrøm


-------------------------------------------------------------------------
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/
-------------------------------------------------------------------------
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/
Antonio Regidor García | 7 Sep 19:29 2007
Picon
Picon

Re: setting button size

I use "outerSize := sz 50 50" and it works ok.

Antonio Regidor Garcia

       
____________________________________________________________________________________
Sé un Mejor Amante del Cine                         
¿Quieres saber cómo? ¡Deja que otras personas te ayuden!
http://advision.webevents.yahoo.com/reto/entretenimiento.html

-------------------------------------------------------------------------
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/
Antonio Regidor García | 7 Sep 20:02 2007
Picon
Picon

Problems handling events

Hi,

Is there another function apart form propagateEvent to send events to the "standard" event
handler?

For example in these situations:

1) I have some TexEntry widgets on a frame. If the user press Tab, focus moves to next TexEntry.
Now, I want to handle that event this way: if user press Tab, the program does something (for
example, check if the text entered is a number) and then pass the event to the "standard" handler
to move the focus to the next widget. I could change the focus by hand, but this is cumbersome, I
don't want to manage a list of widgets, use a Var to store where focus is, etc., this is
wxhaskell's job.

2) I need to autocomplete text on a TextEntry. So, if I use "on keyboard" to detect when user
types next letter, and thus I can do something with that letter, the "standard" event handler
doesn't see the event, and thus the letter is not printed on the TextEntry. I have to do something
like "set text :~ (++ <letter>)". The problem is that these events only detect keypresses, not
text. If user press "A" I only see a "shift key press" followed by "a key press". I have to
translate key press sequences to text, which is a pain for languages with accented characters, and
impossible if user press Ctrl-v and pastes some text. If I could do something like:

on keyboard ::= \w -> standardHandler >> get w text >>= myFunction

this problem dissapears.

Is there a way to do this, or something with the same result?

Antonio Regidor Garcia

       
____________________________________________________________________________________
Sé un Mejor Amante del Cine                         
¿Quieres saber cómo? ¡Deja que otras personas te ayuden!
http://advision.webevents.yahoo.com/reto/entretenimiento.html

-------------------------------------------------------------------------
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/
Antonio Regidor García | 7 Sep 20:07 2007
Picon
Picon

Re: setting button size


> I use "outerSize := sz 50 50" and it works ok.
> 

It works also on Windows (last shelarcy binary).

       
____________________________________________________________________________________
Sé un Mejor Amante del Cine                         
¿Quieres saber cómo? ¡Deja que otras personas te ayuden!
http://advision.webevents.yahoo.com/reto/entretenimiento.html

-------------------------------------------------------------------------
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/

Gmane