Hola amigos,
Estoy intentando insertar en mi aplicacion un vbox y dentro un menu y no lo consigo hacer.
Todo esta dentro de una clase y creo que pudiera ser algo realiztivo a definir algo global o alguna variable o algo.
Os paso el codigo a ver si me podeis ayudar.
Os pongo en azul lo que creo importante.
El error que da el debbug es :
(berki-msat.phk:3976): Gtk-CRITICAL **: file gtkbin.c: line 217 (gtk_bin_add): a
ssertion `bin->child == NULL' failed
------------------------
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN')
{
define("bar", '\\');
dl('php_gtk.dll');
setlocale(LC_ALL, 'POSIX');
}
else
{
define("bar", '/');
dl('php_gtk.so');
setlocale(LC_ALL, 'english');
}
define ('images', 'XPM Imagenes' . bar);
define ("K_ENTER", 65293);
define ("K_ESC", 65307);
define ("K_SPACE", 32);
define ("K_F1", 65470);
define ("K_F2", 65471);
define ("K_F3", 65472);
define ("K_F4", 65473);
define ("K_TAB", 65289);
include_once 'classes/ki-msateditor.class';
include_once 'warnings.class';
class App
{
function App($argv)
{
$win = new GTKWarning('Error en la aplicacion',"./info.xpm");
include 'berki-msat.inc';
$this->Servidor = $Servidor;
$this->MainWindow = &new Gtkwindow(GTK_WINDOW_POPUP);
$this->MainWindow->set_title('Berki-Msat');
$this->MainWindow->set_position(GTK_WIN_POS_CENTER);
$this->MainWindow->connect_object('destroy', array('Gtk', 'Main_quit'));
$this->MainWindow->realize();
$PixStart = Gdk::pixmap_create_from_xpm($this->MainWindow->window, null, 'XPM Imagenes/inicio1.xpm');
$Start = new GtkPixmap($PixStart[0], $PixStart[1]);
$fixed = &new GtkFixed;
$this->MainWindow->add($fixed);
$fixed->put($Start, 0, 0);
$this->Usuarios = &new GtkText();
$this->Usuarios->set_usize(112,20);
$this->Usuarios->set_editable(true);
if ($Usuario){ $this->Usuarios->insert(null,null,null,$Usuario); }
$fixed->put($this->Usuarios, 264, 190);
$this->Llaves = &new GtkText();
$this->Llaves->set_usize(112,20);
$this->Llaves->set_editable(True);
if ($Llave){ $this->Llaves->insert(null,null,null,$Llave); }
$fixed->put($this->Llaves, 264, 215);
$this->Servidores = &new GtkText();
$this->Servidores->set_usize(112,20);
$this->Servidores->set_editable(True);
if ($Servidor){ $this->Servidores->insert(null,null,null,$Servidor); }
$fixed->put($this->Servidores, 264, 240);
$button = new GtkButton(' ENTRAR ');
$button->connect_object('clicked', array(&$this, 'Start'), $argv);
$fixed->put($button, 320, 290);
$button2 = new GtkButton(' SALIR ');
$button2->connect_object('clicked', array(Gtk, 'main_quit'));
$fixed->put($button2, 250, 290);
$this->MainWindow->show_all();
}
function Start($argv)
{
$entry1 = $this->Usuarios->entry;
$entry2 = $Llave;
$entry3 = $this->Servidores->entry;
//$Usuario = $entry1->get_text();
//$Servidor = $entry3->get_text();
Gtk::rc_parse("themes/$Theme/gtk/gtkrc");
$this->MainWindow->hide();
$fd = fopen ('berki-msat.inc', "w");
if ($fd)
{
fwrite ($fd, "<?\n");
fwrite ($fd, " \$Usuario='$Usuario';\n");
fwrite ($fd, " \$Llave='$Llave';\n");
fwrite ($fd, " \$Servidor='$Servidor';\n");
fwrite ($fd, "?>\n");
}
fclose($fd);
new editor();
}
}
function CerrarAplicacion() {
echo "\n Se ha presionado el menu Salir \n";
gtk::main_quit();
}
Class editor
{
function editor() {
if (!isset($windows['berki-msat'])) {
$window = new GtkWindow;
$windows['berki-msat'] = $window;
$window->connect('delete_event', 'delete_event');
$window->set_title('berki-msat');
$window-> set_uposition(0, 0);
$window->set_default_size((gdk::screen_width()), -25); // Ventana maximizada
//$window->set_position(GTK_WIN_POS_CENTER);
$window->realize();
$vbox = new GtkVBox;
$window->add($vbox);
$hbox1 = new GtkHBox;
$BarraMenu = &new GtkMenuBar;
$MenuGeneral = &new GtkMenuItem("General");
$MenuGeneral->lock_accelerators();
$SubMenuGeneral = &new GtkMenu();
$SubMenuGeneralPreferencias = &new GtkMenuItem("Preferencias");
$SubMenuGeneralSalir = &new GtkMenuItem("Salir");
$SubMenuGeneralSalir-> connect("activate","CerrarAplicacion");
$SubMenuGeneral->append($SubMenuGeneralPreferencias);
$SubMenuGeneral->append($SubMenuGeneralSalir);
$SubMenuGeneral-> connect('move-current', 'test_selected', GTK_MENU_DIR_NEXT);
$MenuGeneral-> set_submenu($SubMenuGeneral);
$MenuVer = &new GtkMenuItem("Ver");
$MenuVer->lock_accelerators();
$SubMenuVer = &new GtkMenu();
$SubMenuVerIncidencias = &new GtkMenuItem("Incidencias");
$SubMenuVerInventarios = &new GtkMenuItem("Inventarios");
$SubMenuVerEmails = &new GtkMenuItem("Emails");
$SubMenuVerContratosylicencias = &new GtkMenuItem("Contratos y Licencias");
$SubMenuVerConexiones = &new GtkMenuItem("Conexiones");
$SubMenuVerServiciosCriticos = &new GtkMenuItem("Servicios Criticos");
$SubMenuVerMantenimientoPreventivo = &new GtkMenuItem("Mantenimiento Preventivo");
$SubMenuVerDatos = &new GtkMenuItem("Datos");
$SubMenuVer->append($SubMenuVerIncidencias);
$SubMenuVer->append($SubMenuVerInventarios);
$SubMenuVer->append($SubMenuVerEmails);
$SubMenuVer->append($SubMenuVerContratosylicencias);
$SubMenuVer->append($SubMenuVerConexiones);
$SubMenuVer->append($SubMenuVerServiciosCriticos);
$SubMenuVer->append($SubMenuVerMantenimientoPreventivo);
$SubMenuVer->append($SubMenuVerDatos);
$SubMenuVer-> connect('move-current', 'test_selected', GTK_MENU_DIR_NEXT);
$MenuVer-> set_submenu($SubMenuVer);
$MenuHerramientas = &new GtkMenuItem("Herramientas");
$MenuHerramientas->lock_accelerators();
$MenuAyuda = &new GtkMenuItem("Ayuda");
$MenuAyuda->lock_accelerators();
$SubMenuAyuda = &new GtkMenu();
$SubMenuAyudaManual = &new GtkMenuItem("Manual");
$SubMenuAyudaAcerca = &new GtkMenuItem("Acerca de ...");
$SubMenuAyuda->append($SubMenuAyudaManual);
$SubMenuAyuda->append($SubMenuAyudaAcerca);
$SubMenuAyuda-> connect('move-current', 'test_selected', GTK_MENU_DIR_NEXT);
$MenuAyuda-> set_submenu($SubMenuAyuda);
$BarraMenu->append($MenuGeneral);
$BarraMenu->append($MenuVer);
$BarraMenu->append($MenuHerramientas);
$BarraMenu->append($MenuAyuda);
$BarraMenu->show_all();
$hbox1 = new GtkHBox;
$hbox2 = new GtkHBox;
$BarraMenu->add($hbox1); $window->add($Barramenu);
$window->add($BarraMenu);
}
//if ($windows['notebook']->flags() & GTK_VISIBLE)
// $windows['notebook']->hide();
//else
$windows['berki-msat']->show();
}}
new App($argv);
Gtk::main();
---------------------