jim | 1 Feb 2007 22:27
Favicon

DrawingArea that listens to mouse click signals?

Hi, I'm new to Gtk2hs & GUI programming in haskell generally...I have a 
DrawingArea canvas 
that displays a piece in a board game & which I want to be something the 
user can click 
on (when I will draw it with rotation) or drag and drop. I started out 
with the `drawing' demo and am customising it...I can get the DrawingArea 
object to listen to mouse motion events (onEnter) but not clicks - is it 
only Buttons that can have an 
onClicked handler? How then to respond to mouse clicks? I then tried to 
use buttonSetImage to draw the 
canvas onto a button, but this didn't seem to work.

Is there any demo/sample code I could look at for this?

Many thanks.

jim <at> sdf-eu.org
SDF-EU Public Access UNIX System - http://sdf-eu.org

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Duncan Coutts | 2 Feb 2007 12:53
Picon
Picon
Favicon

Re: DrawingArea that listens to mouse click signals?

On Thu, 2007-02-01 at 21:27 +0000, jim <at> droog.sdf-eu.org wrote:
> Hi, I'm new to Gtk2hs & GUI programming in haskell generally...I have a 
> DrawingArea canvas 
> that displays a piece in a board game & which I want to be something the 
> user can click 
> on (when I will draw it with rotation) or drag and drop. I started out 
> with the `drawing' demo and am customising it...I can get the DrawingArea 
> object to listen to mouse motion events (onEnter) but not clicks - is it 
> only Buttons that can have an 
> onClicked handler? How then to respond to mouse clicks? 

You want onButtonPress or onButtonRelease:

http://haskell.org/gtk2hs/docs/current/Graphics-UI-Gtk-Abstract-Widget.html#6

There is a slight difference between a Button widget's pressed signal
and these mouse click signals. The onButtonPress/onButtonRelease refer
exactly to mouse clicks. The Button widget's onClicked signal is a
slightly higher level thing. It corresponds to when the button widget is
selected, which can happen when there is a mouse press / release pair
that occur over the button, but it can also happen if you press the
space or enter keys while the button widget is selected.

> Is there any demo/sample code I could look at for this?

No, but if you write a tiny demo of this for us, then there will be for
the next person! :-)

Duncan

(Continue reading)

Duncan Coutts | 2 Feb 2007 19:39
Picon
Picon
Favicon

Gtk2Hs 0.9.11 release candidate 2 available for testing

All,

The second release candidate for Gtk2Hs 0.9.11 is now available.
(The actual version number is 0.9.10.6)

The source tarball and windows installer are available:

http://haskell.org/gtk2hs/gtk2hs-0.9.10.6.tar.gz
(md5sum 8842898cb1f6b595b5a3a057e66a810b)

http://haskell.org/gtk2hs/gtk2hs-0.9.10.6.exe
(md5sum )

and the corresponding documentation:
http://haskell.org/gtk2hs/docs/gtk2hs-docs-0.9.10.6/

Changes since the first release candidate: 
      * now works again in GHCi (even in Windows! - at least with
        GHC-6.6)
      * new functions for working with the threaded RTS
      * Windows version now uses the "MS Windows" theme by default
      * Windows version now comes with the Gtk+ OpenGL package
      * minor fixes to various demo programs
      * the svgcairo package now uses librsvg rather than libsvg-cairo

This release candidate is being announced more widely, on the Gtk2Hs
website and on the Haskell libraries mailing list. The final release
will also be announced on the GNOME-announce and Haskell mailing lists.

Otherwise, the notes are much the same as for the first RC:
(Continue reading)

jim | 3 Feb 2007 00:57
Favicon

Re: DrawingArea that listens to mouse click signals?

On Fri, 2 Feb 2007, Duncan Coutts wrote:

> Date: Fri, 02 Feb 2007 11:53:25 +0000
> From: Duncan Coutts <duncan.coutts <at> worc.ox.ac.uk>
[snip]
>
> You want onButtonPress or onButtonRelease:
>
> http://haskell.org/gtk2hs/docs/current/Graphics-UI-Gtk-Abstract-Widget.html#6
>
>

Thanks a lot, and thanks to the others who replied - that's put me on the 
right track.

> There is a slight difference between a Button widget's pressed signal
> and these mouse click signals. The onButtonPress/onButtonRelease refer
> exactly to mouse clicks. The Button widget's onClicked signal is a
> slightly higher level thing. It corresponds to when the button widget is
> selected, which can happen when there is a mouse press / release pair
> that occur over the button, but it can also happen if you press the
> space or enter keys while the button widget is selected.
>
>> Is there any demo/sample code I could look at for this?
>
> No, but if you write a tiny demo of this for us, then there will be for
> the next person! :-)
>

I'd be very happy to! I have had a go at making a minimal example of 
(Continue reading)

Wojciech Kaczmarek | 4 Feb 2007 18:45
Gravatar

0.9.10.6 Mac OS X/PPC build report

Hello and welcome!

As you requested, here's the info of an successful build of Gtk2hs  
0.9.10.6. I'm new to Gtk2hs so the only feedback I can provide right  
now is about building the lib and running demos.

My configuration:
Mac OS X 10.4.8 / PPC G4
GHC: 6.6
Gtk: 2.10.7 - recent build from macports (aka darwinports)

Gtk packages used:
* glib          : yes
* gtk           : yes
* glade         : yes
* cairo         : yes
* svgcairo      : yes
* gtkglext      : yes
* gconf         : yes
* sourceview    : yes
* mozembed      : no
* soegtk        : yes
* documentation : no

first configuration to get things reasonably fast:
PKG_CONFIG_PATH=/opt/local/lib/pkgconfig ./configure --with-hcflags=- 
O0 --disable-split-objs
make: success
make installcheck: success
demos: look nice :-]
(Continue reading)

Georg Neis | 4 Feb 2007 22:03
Picon

ModelView.listStoreNew []

Hello,

if I edit demo/treeList/ListDemo.hs such that New.listStoreNew is
called with the empty list (instead of the list of length 3), then the
program does no longer work: starting it has no visual effect.  I would
have expected it to open a window with an empty view.  Strace
outputs
  rt_sigprocmask(SIG_BLOCK, [], [], 8)    = 0
  rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
in an endless loop.  I can cancel the programm by pressing CTRL+C
whereupon the message
  listdemo: gtk2hs_store_iter_next_impl: interrupted
appears.

Kind regards,
Georg
--

-- 
If the shoe fits, buy the other one, too.

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Georg Neis | 4 Feb 2007 22:08
Picon

missing initGUI causes segfault

Hello,

I was playing around in ghci and forgot to call initGUI.  Here's the
result:

Loading package base ... linking ... done.
Prelude> :m Graphics.UI.Gtk
Prelude Graphics.UI.Gtk> windowNew
Loading package haskell98 ... linking ... done.
Loading package glib-0.9.10.6 ... linking ... done.
Loading package mtl-1.0 ... linking ... done.
Loading package cairo-0.9.10.6 ... linking ... done.
Loading package gtk-0.9.10.6 ... linking ... done.

(process:30759): GLib-GObject-CRITICAL **: gtype.c:2242: initialization
assertion failed, use IA__g_type_init() prior to this function

(process:30759): GLib-GObject-CRITICAL **: gtype.c:2242: initialization
assertion failed, use IA__g_type_init() prior to this function

(process:30759): GLib-GObject-CRITICAL **: gtype.c:2242: initialization
assertion failed, use IA__g_type_init() prior to this function

(process:30759): GLib-GObject-CRITICAL **: gtype.c:2242: initialization
assertion failed, use IA__g_type_init() prior to this function

(process:30759): GLib-GObject-CRITICAL **: g_type_add_interface_static:
assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(process:30759): GLib-GObject-CRITICAL **: gtype.c:2242: initialization
(Continue reading)

Duncan Coutts | 5 Feb 2007 00:07
Picon
Picon
Favicon

Re: missing initGUI causes segfault

On Sun, 2007-02-04 at 22:08 +0100, Georg Neis wrote:
> Hello,
> 
> I was playing around in ghci and forgot to call initGUI.  Here's the
> result:

Yep, there's not a whole lot we can do about that except tell people to
always call initGUI first. We could check on every call but that seems a
bit excessive.

Duncan

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Duncan Coutts | 5 Feb 2007 00:25
Picon
Picon
Favicon

Re: ModelView.listStoreNew []

On Sun, 2007-02-04 at 22:03 +0100, Georg Neis wrote:
> Hello,
> 
> if I edit demo/treeList/ListDemo.hs such that New.listStoreNew is
> called with the empty list (instead of the list of length 3), then the
> program does no longer work: starting it has no visual effect.  I would
> have expected it to open a window with an empty view.  Strace
> outputs
>   rt_sigprocmask(SIG_BLOCK, [], [], 8)    = 0
>   rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
> in an endless loop.  I can cancel the programm by pressing CTRL+C
> whereupon the message
>   listdemo: gtk2hs_store_iter_next_impl: interrupted
> appears.

Thanks. I can reproduce this. I'll investigate.

Duncan

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Maurício | 6 Feb 2007 12:27
Picon
Favicon

DLL clash in windows installer

Hi,

Gtk2hs release candidate installer in Windows
complains that there are DLLs in my system that
could confuse gtk2hs. However, I need those DLLs
in the patch in order to use other programs. So,
I would like to sugest: could gtk2hs rename its
DLLs to avoid conflict? For instance, iconv_for_gtk.dll
instead of iconv.dll? Or, if that doesn't seems
nice, could the installer add a "go forward, I
know what I'm doing" option for those who understand
the problem and want to install gtk2hs anyway?

Best,
Maurício

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

Gmane