[Gambas-user] Problem with the gb.gtk component

Dani Santos jose.santos at ...429...
Mon Jul 4 09:06:10 CEST 2005


Hi All! This is my first post to the list

I have developed a simple app that helps to solve printer problems under
LinEx 2004, to be used in the schools at Extremadura (Spain). It works
perfectly with the gb.qt component but not so with the gtk component
(the one I would like to use). 

I'll start with one problem using a ListView control:

- The main window shows the printers installed in the system in a
ListView control. If you select one of them, another ListView control
shows the jobs queued in that printer.

With the gb.gtk component, when you select a printer in that ListView
control, raises the following error:

Null object

And stops. Here is the code and the buggy line:


PRIVATE SUB actualizarFormulario(pActualizarImpresoras AS Boolean,
pActualizarTrabajos AS Boolean)
  DIM strKeyImpresoraActual AS String
  DIM strKeyTrabajoActual AS String

  ME.Mouse = 3

  listaImpresoras.Enabled = Not (optTodasImpresoras.Value)
  IF optTodosTrabajos.Value Or optNingunTrabajo.Value THEN
    listaTrabajos.Enabled = FALSE
  ELSE
    listaTrabajos.Enabled = TRUE
  ENDIF
  chkGuiar.Visible = chkReanudarImpresora.Value

  ' Para quedar seleccionada la impresora actual.
  IF optSeleccionarImpresora.Value And listaImpresoras.Count <> 0 THEN

    ' ===============================================================
    ' ======    BELOW IS THE BUGGY LINE (Aquí casca)    ======
    ' ===============================================================

    strKeyImpresoraActual = listaImpresoras.Current.Key
  ENDIF

  ' Para quedar seleccionado el trabajo actual.
  IF optSeleccionarTrabajo.Value And listaTrabajos.Count <> 0 THEN
    strKeyTrabajoActual = listaTrabajos.Current.Key
  ENDIF

  IF pActualizarImpresoras THEN cargarImpresoras()
  IF pActualizarTrabajos THEN cargarTrabajos()

  IF optSeleccionarImpresora.Value And listaImpresoras.Count <> 0 THEN
    IF Not listaImpresoras.MoveTo(strKeyImpresoraActual) THEN
      listaImpresoras.Item.Selected = TRUE
      listaImpresoras.Current.EnsureVisible()
    ENDIF
  ENDIF

  IF optSeleccionarTrabajo.Value And listaTrabajos.Count <> 0 THEN
    IF Not listaTrabajos.MoveTo(strKeyTrabajoActual) THEN
      listaTrabajos.Item.Selected = TRUE
      listaTrabajos.Current.EnsureVisible()
    ENDIF
  ENDIF

  ME.Mouse = -1

  SELECT CASE m_bytModoFormulario
  CASE MODOFORM_SIMPLE
    btnCambiarModo.Caption = "&Modo avanzado"
    logo.Visible = FALSE
    fraImpresoras.Visible = FALSE
    fraTrabajos.Visible = FALSE
    fraOpciones.Visible = FALSE
    fraModoSimple.Visible = TRUE
    fraBotones.Top = fraModoSimple.Top + fraModoSimple.Height + 10

  CASE MODOFORM_AVANZADO
    btnCambiarModo.Caption = "&Modo simple"
    logo.Visible = TRUE
    fraImpresoras.Visible = TRUE
    fraTrabajos.Visible = TRUE
    fraOpciones.Visible = TRUE
    fraModoSimple.Visible = FALSE
    fraBotones.Top = fraOpciones.Top + fraOpciones.Height + 10
  END SELECT

  ME.Border = window.Resizable
  ME.Height = fraBotones.Top + fraBotones.Height + 10
  ME.Border = window.Fixed
END


The full code is available at:
http://forja.linex.org/project/showfiles.php?group_id=26&release_id=202

(It was tested to work with the 1.9.3 version of gambas. I've seen there
are a few things to solve to make it work with the 1.9.9 version)


Thanks in advance for your help!!!




-- 
José Daniel Santos Delgado
Programador del IESO Quercus (Malpartida de Plasencia)
http://iesoquercus.juntaextremadura.net/dani/
Tfno: 927010850         Fax: 927010851





More information about the User mailing list