diff options
| author | trustable-code <krauter.simon@arcor.de> | 2020-01-21 20:03:57 +0100 |
|---|---|---|
| committer | trustable-code <krauter.simon@arcor.de> | 2020-01-21 20:03:57 +0100 |
| commit | eaf1a0b686d2a18352a2b27d55e9dae02535b600 (patch) | |
| tree | b4271389f315899f632cb0fcecd7b87104008e4d | |
| parent | 75a24b5a8268b0126cc37e49bdefe9ecf6ca34c1 (diff) | |
| download | NiGui-eaf1a0b686d2a18352a2b27d55e9dae02535b600.tar.gz NiGui-eaf1a0b686d2a18352a2b27d55e9dae02535b600.zip | |
Retain order of controls when removing a control from a container
| -rwxr-xr-x | src/nigui.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nigui.nim b/src/nigui.nim index fd5810f..aa668cc 100755 --- a/src/nigui.nim +++ b/src/nigui.nim @@ -1947,7 +1947,7 @@ method add(container: Container, control: Control) = raiseError("Control can be added only to one container.") container.fChildControls.add(control) control.fParentControl = container - control.fIndex = 0 + control.fIndex = container.fChildControls.high container.triggerRelayout() method remove(container: Container, control: Control) = @@ -1955,7 +1955,7 @@ method remove(container: Container, control: Control) = raiseError("control can not be removed because it is not member of the container") else: let startIndex = control.fIndex - container.fChildControls.del(container.fChildControls.find(control)) + container.fChildControls.delete(startIndex) for i in startIndex..container.childControls.high: container.childControls[i].fIndex = i container.triggerRelayout() |
