Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/05/2002, 16:39
Avatar de epplestun
epplestun
 
Fecha de Ingreso: octubre-2001
Mensajes: 1.621
Antigüedad: 23 años, 5 meses
Puntos: 5
Un pokito de PHP-GTK

JEJE hacia tiempo que no escribia sobre PHP-GTK y hoy que e consegido nuevas cositas pos las cuento, que os parece?¿

Bien el caso es que os voy a poner un poquito de codigo para que lo disfruteis, es bien simple jeje ami me costo unas horitas encotnrar el fallo pero bueno ahora que funciona perfectamente os lo dejo aqui:

<?php
dl(stristr(PHP_OS, "WIN") ? "php_gtk.dll" : "php_gtk.so");
function load_a_node($Gtk_Tree) {
global $_pixmap;
foreach (get_defined_functions() as $where => $funcs)
foreach ($funcs as $item) {
for($i=0;$i<=$item;$i++){
$text[0] = sprintf($item, $cur_depth, $i);
$Gtk_Tree->insert_node(NULL, NULL, $text, 5, $_pixmap, $_pixmapmask, $_pixmap, $_pixmapmask, false, false);
}
}
}
function hola(){
global $Gtk_Tree;
$node = $Gtk_Tree->selection;
list ($text,$spacing, $pixmap, $mask) = $Gtk_Tree->node_get_pixtext($node[0],0);
echo $text;
}
list($_pixmap, $pixmapmask) = Gdk::pixmap_create_from_xpm(NULL, NULL, 'imagenes/ctree.xpm');
$window = &new GtkWindow();
$Gtk_Scroll = &new GtkScrolledWindow;
$Gtk_Tree = &new gtkctree(1,0,array('Archivos'));
$Gtk_Tree->set_line_style(GTK_CTREE_LINES_NONE);
$Gtk_Tree->connect('realize','load_a_node');
$Gtk_Tree->connect_after('tree_select_row', 'hola');
$Gtk_Tree->show();
$Gtk_Scroll->add_with_viewport($Gtk_Tree);
$window->add($Gtk_Scroll);
$window->show_all();
gtk::main();
?>

Como veis es pokito codigo, lo que hac es insertar una imagen a los nodos del GtkCTree y luego, al clikear sobre un elemento te lo muestra en la consola es muy simple y realmente util, por ejemplo para crear un arbol de directorios etc etc iamginacion al poder, a y deciros que pronto tendreis el PHP-EDDI-DEV

<table style="border:1px solid black"><tr><td><center>
<embed width="88" height="144" src="http://www.alaplaya.com/~epplestun/yo.swf"></td></td><font face=verdana size=1>Ivan Rodriguez el poder es [B]PHP</p></td></tr></table>