I have an application I’m trying to write that involves a modular dialog. I want to be able to remove an object from the dialog dynamically without affecting other objects, but having layout cascade. However, send(Dialog, delete, Obj)
leaves a gap, as does deleting from the chain. I’ve tried to get around this by deleting the object from the chain and clearing the dialog and then appending back every item in the dialog. This doesn’t seem to help much either, since deleting the first object now cascades only the second object for some reason, still unsure as to why. It seems like there must be some floating pointers left behind in chain somehow. Is my only reliable option for managing dynamic dialogs to do manual placements?
This is the code I’m currently looking at and I am really not happy with it since it is buggy and does not seem very elegant. I cannot find much in the xpce user guide about this.
get(Dialog, size, Size),
get(Size, width, W),
get(Size, height, H),
send(Dialog, size, size(W, H-120)),
get(Dialog, members, Chain),
send(Chain, delete, Group),
send(Group, for_all, message(Group, delete, @arg1)),
chain_list(Chain, L),
send(Dialog, clear),
send(Chain, clear),
%% send(Chain, for_all, message(@prolog, format, '~w\n', @arg1)),
forall(member(X, L),
send(Dialog, append, X)),
send(Dialog, compute),
send(Dialog, fit),
send(Dialog, layout).