Page 1 of 2
Delete window/label?
Posted: Sun May 03, 2015 3:15 am
by Nyyrazzilyss
Is there any way that I can delete a label that i've previously created? I don't want to just hide it, I want it gone. Hiding and recreating does work, but i'm concerned that if that were to occur to many time eventually it would cause a crash.
Re: Delete window/label?
Posted: Mon May 04, 2015 5:44 am
by Akaya
No. Once creating, there is no deleting a label. It is best to recycle them. What is it you're trying to do where they must be deleted?
Re: Delete window/label?
Posted: Mon May 04, 2015 11:58 am
by Nyyrazzilyss
- Screenshot, NyyLIB
I have a number of labels that change based on what class a character is logged in as - If they rent for example, then log back in (without closing mudlet) the gui will regenerate for that class.
I have been using text labels, but png graphics allow for better handling of sizing/scaling. I've found a lot of people using early generation macbooks, and given the number of icons I wanted occuring on a horizontal bar, I ended up with a size of 64px. Right now i'm in the process of adding an option to dynamically move the iconbar from horizontal to vertically across the left side of the display. Easiest was just to recreate all windows, but that doesn't work if I can't delete older windows (i'll be leaking memory, and eventually crash)
Re: Delete window/label?
Posted: Fri May 08, 2015 1:34 pm
by SlySven
The trouble is that each new window/label (and stopwatches as it happens) created gets a monotonically incrementing (goes up by one each time
) Id and the code to handle gaps in such a sequence that deletions would cause means more coding work IMHO.
Re: Delete window/label?
Posted: Wed May 13, 2015 3:43 pm
by Akaya
You could create both icon bars and have a toggle that hides one when the other is shown. Hide and show will not recreate the labels.
Re: Delete window/label?
Posted: Sat May 16, 2015 3:52 am
by Nyyrazzilyss
I rewrote how I was handling labels, and solved the issue.
Regardless of class logged in, the labels are all at assigned locations. Rather then creating new labels, I create labels as needed, and place them in a key/value array (button1="xxx", button2="xxx", etc). I changed how I was accessing the labels to use a function that would lookup based on the xxx name, and return the label associated with the correct button number (or create the label if it hadn't been previously used). This lets me create them all a single time, and then reuse them for multiple character classes.
Re: Delete window/label?
Posted: Sun Feb 19, 2017 2:27 pm
by Garagoth
A very inconvenient issue... there is even a plan(?) to make it possible:
https://bugs.launchpad.net/mudlet/+bug/1096051
I ended up creating a pool of labels and recycling them (hide, reposition, show when needed).
Re: Delete window/label?
Posted: Sun Feb 19, 2017 4:49 pm
by Jor'Mox
Correct me if I'm wrong, but if I create a label with a specific name, and then try to create a label with the same name, no new label is created, the original one is just "recycled" so to speak. While it wouldn't be bad to be able to delete a label, I have never had issues come up due to not being able to do so.
Re: Delete window/label?
Posted: Wed Feb 22, 2017 6:14 am
by Vadi
It does seem to be the case. So static UI's aren't affected by this and the more dynamic ones can do the recycling as you mentioned - which is why it hasn't been that pressing of an issue. In fact it's not in to begin with due to performance reasons. Certainly not against making it work though as it's a hassle.
Maybe you could publish your package that allows this recycling?
Re: Delete window/label?
Posted: Sat Feb 25, 2017 11:30 pm
by SlySven
I thought I had prototyped some C++ code to proved a
deleteLabel() Lua command - but I cannot currently find it
...