diff --git a/devel/scheme/gui/scheme-gui-lists-trees.en.tm b/devel/scheme/gui/scheme-gui-lists-trees.en.tm index 815ad62..d2c771f 100644 --- a/devel/scheme/gui/scheme-gui-lists-trees.en.tm +++ b/devel/scheme/gui/scheme-gui-lists-trees.en.tm @@ -1,4 +1,4 @@ - + @@ -110,7 +110,7 @@ > <\explain> - )> )> <|explain> The provides a graphical representation of a @@ -137,7 +137,7 @@ <\scm-code> (root - \ \ (library "My bibliography" "icon.xpm" 12345 + \ \ (library "Library" "icon.png" 12345 \ \ \ \ (collection "Cool stuff" 001) @@ -168,28 +168,69 @@ StatusTipRole \ \ \ \ \ ; for the status bar (if present and supported) - DecorationRole \ \ \ \ ; file name of an icon to use (in - $TEXMACS_PIXMAP_PATH) + DecorationRole \ \ \ \ ; file name of an icon to use - CommandRole \ \ \ \ \ \ \ ; command to be executed when the user + CommandRole \ \ \ \ \ \ \ ; sent to the command executed after (double?) clicks - UserRole:\number\ \ ; left to user definition + UserRole:\number\ \ ; left to user definition (will be + returned as strings) - It is possible to omit the data role specification. By default the widget - will use the tree label's string representation as , - , and . For the - it will try to load pixmaps named - in . + It is possible to omit some or all of the + data role specification. By default the widget will use the tree label's + string representation for , , + and . For the + it will try to load pixmaps named label\.xpm> + in . This search + happen if the is + specified (i.e. a full path with or without environment variables and + wildcards must be given). The default is the subtree + itself (see below). - For an example see in . + The first argument of , + , \ is a lambda that will be called when items are + clicked. The procedure must have the following signature: + + <\scm-code> + (lambda (Event CommandRole . UserRoles) (...)) + + + where: + + <\itemize-dot> + is an integer: either 1, 2 or 4 for a single, right + or middle click respectively. In the future, other events could be + supported (like double clicks, drag&drop, unfold, etc.) + + is either the value of that role if given for + the data item, or the subtree itself otherwise. + + is a (possibly empty) list with the data for + those roles given in the data role specification. + + + If multiple selections are enabled and one is made, and + will both be lists (not implemented yet). Keep in mind + that the data is a tree and thus not a copy but always a + pointer to the actual data (unless you copy or transform it into another + format with e.g. stree>) + + See in + and + ``''. - + - We build on the previous example: + We build on the previous example, but now we add a command. Notice how the + way one adds commands to departs from that of other + widgets, where instead of a procedure one must provide a list with code + expecting one or two arguments with fixed names (usually and + ). : this is easily + changed in , but it seems easier to manage empty arguments + this way. <\session|scheme|default> <\input|Scheme] > @@ -199,7 +240,7 @@ \ \ \ '(root - \ \ \ \ \ (library "My bibliography" "icon.xpm" 12345 + \ \ \ \ \ (library "Library" "$TEXMACS_PIXMAP_PATH/tm_german.xpm" 01 \ \ \ \ \ \ \ \ \ \ \ \ \ \ (collection "Cool stuff" 001) @@ -224,7 +265,15 @@ \ \ \ \ \ \ \ \ \ \ (collection DisplayRole UserRole:1)))) - <\unfolded-io|Scheme] > + <\input|Scheme] > + (define (action clicked cmd-role . user-roles) + + \ \ (display* "clicked= " clicked ", cmd-role= " cmd-role + + \ \ \ \ \ \ \ \ \ \ \ \ ", user-roles= " user-roles "\\n"))) + + + <\input|Scheme] > (tm-widget (widget-library) \ \ (resize ("150px" "400px" "9000px") ("300px" "600px" "9000px") @@ -235,16 +284,17 @@ \ \ \ \ \ \ === - \ \ \ \ \ \ (tree-view t dd)))) - <|unfolded-io> - \; - + \ \ \ \ \ \ (tree-view action t dd)))) + <\input|Scheme] > (top-window widget-library "Tree View") + Notice how we must add to the name of the + pixmap because we are not using the default .\ + We can even use the as argument to .