���
----- Original Message -----From: J. P. L. Mart��nSent: Friday, January 11, 2013 3:50 PMSubject: [Pharo-project] Dynamic GUI possible?Hi, I'm trying to display buttons only if a condition is true on the same window, making the condition is easy but I can get the conditional to run again when a change is done so it displays the row with the buttons, here is the code:
open
| builder content |
builder := UITheme builder.
content := builder
newColumn:
{(builder
newRow:
{(builder
newButtonFor: self
action: #listaPrestamos
label: 'Prestamos'
help: 'Listar Prestamos').
(builder
newButtonFor: self
action: #listaMateriales
label: 'Material'
help: 'Listar Material').
(builder
newButtonFor: self
action: #listaSocios
label: 'Socios'
help: 'Listar Socios').
(builder
newButtonFor: self
action: #listaEjemplares
label: 'Ejemplares'
help: 'Lista de Ejemplares')}).
(builder
newColumn:
{((PluggableMultiColumnListMorph
on: self
list: #listado
selected: #seleccionado
changeSelected: #seleccionado:
menu: nil
wrapSelector: #wrap:at:) extent: 600@600)})}.
#listado = Prestamo database ifTrue: [builder
newRow:
{(builder
newButtonFor: self
action: #addPrestamo
getEnabled: nil
label: 'Nuevo Prestamo'
help: 'Ingresar nuevo prestamo').
(builder
newButtonFor: self
action: #devPrestamo
getEnabled: #selecciono
label: 'Devolver'
help: 'Devolver').
(builder
newButtonFor: self
action: #addEjemplar
label: 'Agregar Ejemplar'
help: 'Ingresar nuevo ejemplar').
(builder
newButtonFor: self
action: #addMaterial
label: 'Agregar Material'
help: 'Ingresar nuevo material').
(builder
newButtonFor: self
action: #addSocio
label: 'Nuevo Socio'
help: 'Ingresar nuevo socio').
(builder
newButtonFor: self
action: #remover
getEnabled: #selecciono
label: 'Remover'
help: 'Ingresar nuevo prestamo').
(builder
newButtonFor: self
action: #guardar
label: 'guardar'
help: 'Ingresar nuevo socio')}] ifFalse: (Transcript show: 'Flase'; cr).
(content openInWindowLabeled: 'Babel') extent: 600 @ 600.
self changed: #listado;
changed: #open.