David Leuschner | 9 Dec 16:45 2007
Picon

Sorted TreeView

Hi all,

I've been trying to display a list in a TreeView with clickable column
headers, that change the order of the list items.  I wrote a simple
program using TreeStore as a model (see attachment). Running this program
produces the following output if the column header is clicked:

(TreeViewColumnReorder:14348): Gtk-CRITICAL **: gtk_tree_sortable_get_sort_column_id:
assertion `GTK_IS_TREE_SORTABLE (sortable)' failed

(TreeViewColumnReorder:14348): Gtk-CRITICAL **: gtk_tree_sortable_has_default_sort_func:
assertion `GTK_IS_TREE_SORTABLE (sortable)' failed

(TreeViewColumnReorder:14348): Gtk-CRITICAL **: gtk_tree_sortable_set_sort_column_id:
assertion `GTK_IS_TREE_SORTABLE (sortable)' failed

I tried using treeModelSortWithNewModel but calling this function always
kills the program with the following message:

TreeModelSort: schedule: re-entered unsafely.
   Perhaps a 'foreign import unsafe' should be 'safe'?

I am using the the 0.9.12.1 release of Gtk2Hs and am compiling with GHC
6.8.1. Any help would be greatly appreciated!

Cheers,

   David

--
(Continue reading)

Axel Simon | 13 Dec 15:31 2007
Picon

Re: Sorted TreeView


Hi David,

sorry to be so slow to respond.

On Dec 9, 2007, at 16:45, David Leuschner wrote:

> Hi all,
>
> I've been trying to display a list in a TreeView with clickable column
> headers, that change the order of the list items.  I wrote a simple
> program using TreeStore as a model (see attachment). Running this  
> program
> produces the following output if the column header is clicked:

[..]

> TreeModelSort: schedule: re-entered unsafely.
>    Perhaps a 'foreign import unsafe' should be 'safe'?

Well, this is definitely a bug in Gtk2Hs which is hopefully fixed by  
the patch that I've just pushed to darcs.

> I am using the the 0.9.12.1 release of Gtk2Hs and am compiling with  
> GHC
> 6.8.1. Any help would be greatly appreciated!
>

The story with sorted trees is that our own models, ListStore and  
TreeStore don't support them at the moment and probably never will  
(Continue reading)

David Leuschner | 13 Dec 21:06 2007
Picon

Re: Sorted TreeView

Hi Axel,

your patch works fine and I can create a new TreeModelSort. Unfortunately
I can't render any columns. The following code

import Graphics.UI.Gtk
import Graphics.UI.Gtk.ModelView as Mv
import Data.Tree

main =
    do initGUI
       win <- windowNew
       rawmodel <- Mv.treeStoreNew [Node "foo" [], Node "bar" []]
       model <- Mv.treeModelSortNewWithModel rawmodel
       view <- Mv.treeViewNewWithModel model
       col <- Mv.treeViewColumnNew
       rend <- Mv.cellRendererTextNew
       Mv.cellLayoutPackStart col rend True
       Mv.cellLayoutSetAttributes col rend rawmodel (\v -> [Mv.cellText := v])
       Mv.treeViewAppendColumn view col
       containerAdd win view
       widgetShowAll win
       mainGUI

gives me the error message:

  TreeViewColumnReorder: cellLayoutSetAttributes: attempt to set
  attributes of CellRenderer from different model.

But changing 
(Continue reading)

Axel Simon | 14 Dec 11:22 2007
Picon

Re: Sorted TreeView

David,

On Dec 13, 2007, at 21:06, David Leuschner wrote:

> Hi Axel,
>
> your patch works fine and I can create a new TreeModelSort.  
> Unfortunately
> I can't render any columns. The following code
>
> import Graphics.UI.Gtk
> import Graphics.UI.Gtk.ModelView as Mv
> import Data.Tree
>
> main =
>     do initGUI
>        win <- windowNew
>        rawmodel <- Mv.treeStoreNew [Node "foo" [], Node "bar" []]
>        model <- Mv.treeModelSortNewWithModel rawmodel
>        view <- Mv.treeViewNewWithModel model
>        col <- Mv.treeViewColumnNew
>        rend <- Mv.cellRendererTextNew
>        Mv.cellLayoutPackStart col rend True
>        Mv.cellLayoutSetAttributes col rend rawmodel (\v ->  
> [Mv.cellText := v])
>        Mv.treeViewAppendColumn view col
>        containerAdd win view
>        widgetShowAll win
>        mainGUI
>
(Continue reading)

Neil Bartlett | 14 Dec 21:48 2007
Picon

Success! Gtk2Hs on Mac OS without X11

This is just to let people on this list know that I have successfully  
compiled Gtk2Hs to run with the "native" Mac OS X port of Gtk here:

	http://developer.imendio.com/projects/gtk-macosx/

Which means it's now possible to run Gtk2Hs applications on the Mac  
without X11. I would post screenshots, but they are essentially  
identical to the X11 version save for the lack of an X icon in the Dock!

Even better, no changes whatsoever were required to Gtk2Hs. The  
process was as follows:

1) Install gtk-macosx following the instructions at
http://developer.imendio.com/projects/gtk-macosx/ 
. Note that it was necessary to patch the glib dependency (as per the  
bug report here: http://bugzilla.gnome.org/show_bug.cgi?id=503334).  
However this will hopefully be unnecessary soon.
2) Ensure /opt/gtk/bin is ahead of /opt/local/bin in your PATH
3) Build Gtk2Hs from source.

Regards,
Neil

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
(Continue reading)

Axel Simon | 14 Dec 22:20 2007
Picon

Re: Success! Gtk2Hs on Mac OS without X11

Hi Neil,

On Dec 14, 2007, at 21:48, Neil Bartlett wrote:

> This is just to let people on this list know that I have successfully
> compiled Gtk2Hs to run with the "native" Mac OS X port of Gtk here:
>
> 	http://developer.imendio.com/projects/gtk-macosx/
>
> Which means it's now possible to run Gtk2Hs applications on the Mac
> without X11. I would post screenshots, but they are essentially
> identical to the X11 version save for the lack of an X icon in the  
> Dock!
>
> Even better, no changes whatsoever were required to Gtk2Hs. The
> process was as follows:
>
> 1) Install gtk-macosx following the instructions at http:// 
> developer.imendio.com/projects/gtk-macosx/
> . Note that it was necessary to patch the glib dependency (as per the
> bug report here: http://bugzilla.gnome.org/show_bug.cgi?id=503334).
> However this will hopefully be unnecessary soon.
> 2) Ensure /opt/gtk/bin is ahead of /opt/local/bin in your PATH
> 3) Build Gtk2Hs from source.
>
>
Wow, that's really cool. I have to admit I never tried the Mac port  
because I thought it wasn't quite finished. But if it works  
reasonably well, we could think of offering the native backend as an  
alternative - maybe we could even build a binary install for Mac OS.
(Continue reading)

Duncan Coutts | 17 Dec 21:54 2007
Picon
Picon

[Fwd: [Haskell-cafe] gtk2hs treeview problem (Windows)]

Forwarding to the Gtk2Hs users mailing list...

-------- Forwarded Message --------
> From: Jian Fan <abemud <at> gmail.com>
> To: haskell-cafe <at> haskell.org
> Subject: [Haskell-cafe] gtk2hs treeview problem (Windows)
> Date: Mon, 17 Dec 2007 19:02:36 +0000 (UTC)
> 
> I installed ghc 6.6.1 and 0.9.12.1. I'm trying to use the tree view widget.
> To enable search in treeview, I added following 2 lines:
> 
>   New.treeViewAppendColumn view col3
> 
>   -- my addition
>   New.treeViewSetEnableSearch view True
>   New.treeViewSetSearchColumn view 0
> 
> in demo/treeList/TreeDemo.hs
> 
> The program crashes if I press any key. The console shows:
> 
> C:\Gtk2Hs\demos\treeList>TreeDemo.exe
> 
> (TreeDemo.exe:3064): GLib-GObject-WARNING **: gtype.c:3339: type id `0' is inval
> id
> 
> (TreeDemo.exe:3064): GLib-GObject-WARNING **: can't peek value table for type `<
> invalid>' which is not currently referenced
> 
> 
(Continue reading)

Eric | 18 Dec 00:25 2007

clicks and TextView

Hi all,

I have written the following code to intercept a mouse click on a TextView:

onButtonPress track (\e -> case e of
                                       Button _ _ _ _ _ _ _ _ _ -> if
eventButton e == RightButton then

          do{ buffer <- textViewGetBuffer track

; (start, end) <- textBufferGetSelectionBounds buffer

; cs <- textIterGetSlice start end

; putStrLn cs

; return True}

else return True)

However, when I run the code, I can no longer select text with the left
mouse button. How can I fix this?

E.

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
(Continue reading)

Eric | 18 Dec 18:07 2007

disabling TextView popup menu

Dear all,

When a TextView is right-clicked, a popup menu appears. How can I 
replace this behaviour with my own action?

E.

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
Andy Gill | 17 Dec 22:40 2007

OSX 10.4

Can anyone suggest the best way of building gtk2hs for OSX 10.4?

I have ghc-6.8.1
port of gtk28
port of gtkglext

source of gtk2hs, 9.12.1

But I just get a bus error when I run it. I've got X running.

Andy Gill

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

Gmane