removing a widget

4 views
Skip to first unread message

Siemen Baader

unread,
Jan 6, 2020, 2:53:40 AM1/6/20
to il...@googlegroups.com
Hi,

so ILWidget has #append: and #prepend: methods, but no #remove method to remove the current widget from the page. Or does it?

I could create an empty 'NullWidget' and use #show: or pass references to the containing widget to mark it dirty as in the ILTodoListApplication example, but these are cumbersome. Any ideas?

Thanks,
Siemen

benoit

unread,
Jan 19, 2020, 6:34:51 PM1/19/20
to il...@googlegroups.com
Hello Siemen,

to remove a widget adder with #append: or #prepend: you just need to
send to the widget the message #answer:

Here an example taken from one of my apps :

MyWidget>>contents
^ [ :e |
e build: self quoiButton.
e build: self emplacementButton.
quoi isNotNil & emplacement isNotNil
ifTrue: [ e build: self createButton ].
e build: self cancelButton ]

MyWidget>>cancelButton
| widget |
widget := NUBButtonWidget new.
widget
text: 'Annuler';
action: [ self answer: nil ].
^ widget


MyWidget is added to MyApp with #append.
NUBButtonWidget is just a widget wrapping a link or a form presented
as a button.
When the user click on the button, MyWidget is removed from MyApp.

@+
Benoit

Le 06/01/20 à 08:53, Siemen Baader a écrit :
> --
> You received this message because you are subscribed to the Google
> Groups "Iliad project" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to iliad+un...@googlegroups.com
> <mailto:iliad+un...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/iliad/CAM47ZxpVOAKYL%2BmU%2BS5Ds8GqAixKBO-JzYqxhvpZxKLh_z6fLA%40mail.gmail.com
> <https://groups.google.com/d/msgid/iliad/CAM47ZxpVOAKYL%2BmU%2BS5Ds8GqAixKBO-JzYqxhvpZxKLh_z6fLA%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Reply all
Reply to author
Forward
0 new messages