Help with treeview

View: New views
4 Messages — Rating Filter:   Alert me  

Help with treeview

by Fernando Correa da Conceição-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am working on a tree view to show a tree of files and dirs(it add the
files and dirs only when expanded, not as a example in the blog of kksou
that load all the tree at once). It is working, but i want improve it in
some ways:

1. How can I get an event when the user clicks with the right mouse
button over a row? I want to show a popup menu in this case.

2. How can I change the identation(increase the distance to the right
that a child is from the parent?

3. How can I make the appereance more like a tree in kde/windows? I mean
use +/- to collapse and expand and draw the lines to show the parent of
a item. What i want is make it see like a GtkCTree in php-gtk1?

4. How can I toggle the state? I mean if a row is colapsed, i want
expand and if expanded I want to collapse?


Thanks,

Fernando Correa da Conceição.

--
PHP-GTK General Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: Help with treeview

by bob majdak jr :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

� wrote:
> 1. How can I get an event when the user clicks with the right mouse
> button over a row? I want to show a popup menu in this case.

not sure if there is a shorter way for this, if i recall correctly i tried several things and this
is what worked the best:

this->connect('button-press-event',array($this,'on_click'));
public function on_click($widget,$event) {
        if($event->button == 3) {
                //. popup() a GtkMenu
        }
}

> 2. How can I change the identation(increase the distance to the right
> that a child is from the parent?

i do not know.

> 3. How can I make the appereance more like a tree in kde/windows? I mean
> use +/- to collapse and expand and draw the lines to show the parent of
> a item. What i want is make it see like a GtkCTree in php-gtk1?

i think you would have to write your own gtkrc and force it upon the application, because this is
determined by the users theme. however in my opinion you probably should not be over ruleing their
theme (especially linux users) because they expect the application to look a certain way like others
using gtk.

> 4. How can I toggle the state? I mean if a row is colapsed, i want
> expand and if expanded I want to collapse?

there are expand methods but gtk.php.net seems to be down, i'll reply with those when i can get in
(unless you find it first)

- bob.

--
PHP-GTK General Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: Help with treeview

by kksou :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Fernando Correa da Conceição-3 wrote:
I am working on a tree view to show a tree of files and dirs(it add the
files and dirs only when expanded, not as a example in the blog of kksou
that load all the tree at once). It is working, but i want improve it in
some ways:

1. How can I get an event when the user clicks with the right mouse
button over a row? I want to show a popup menu in this case.

2. How can I change the identation(increase the distance to the right
that a child is from the parent?

3. How can I make the appereance more like a tree in kde/windows? I mean
use +/- to collapse and expand and draw the lines to show the parent of
a item. What i want is make it see like a GtkCTree in php-gtk1?

4. How can I toggle the state? I mean if a row is colapsed, i want
expand and if expanded I want to collapse?
I have ready examples for 1 and 3.

(1): http://www.kksou.com/php-gtk2/articles/display-directory-tree-using-GtkTreeView---Part-5---add-context-sensitive-popup-menu-on-right-mouse-click.php

(3): http://www.kksou.com/php-gtk2/articles/display-a-tree-structure-with-connecting-lines.php

For (2) and (4), I'll try to come out with examples for them.

Regards,
/kksou


Re: Help with treeview

by kksou :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Fernando Correa da Conceição-3 wrote:
I am working on a tree view to show a tree of files and dirs(it add the
files and dirs only when expanded, not as a example in the blog of kksou
that load all the tree at once). It is working, but i want improve it in
some ways:

1. How can I get an event when the user clicks with the right mouse
button over a row? I want to show a popup menu in this case.

2. How can I change the identation(increase the distance to the right
that a child is from the parent?

3. How can I make the appereance more like a tree in kde/windows? I mean
use +/- to collapse and expand and draw the lines to show the parent of
a item. What i want is make it see like a GtkCTree in php-gtk1?

4. How can I toggle the state? I mean if a row is colapsed, i want
expand and if expanded I want to collapse?
I've just created an example for (3):
http://www.kksou.com/php-gtk2/articles/increase-the-level-of-indentation-in-a-GtkTreeView.php

As for (4), isn't this the default action when you press the + or - (on windows) or the triangle (on linux) for each node? Are you trying to do something differently?

Regards,
/kksou