Delete window/label?
-
- Posts: 334
- Joined: Thu Mar 05, 2015 2:53 am
Delete window/label?
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?
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?
-
- Posts: 334
- Joined: Thu Mar 05, 2015 2:53 am
Re: Delete window/label?
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)
- SlySven
- Posts: 1034
- Joined: Mon Mar 04, 2013 3:40 pm
- Location: Deepest Wiltshire, UK
- Discord: SlySven#2703
Re: Delete window/label?
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?
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.
-
- Posts: 334
- Joined: Thu Mar 05, 2015 2:53 am
Re: Delete window/label?
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.
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?
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).
I ended up creating a pool of labels and recycling them (hide, reposition, show when needed).
Re: Delete window/label?
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?
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?
Maybe you could publish your package that allows this recycling?
- SlySven
- Posts: 1034
- Joined: Mon Mar 04, 2013 3:40 pm
- Location: Deepest Wiltshire, UK
- Discord: SlySven#2703
Re: Delete window/label?
I thought I had prototyped some C++ code to proved a deleteLabel() Lua command - but I cannot currently find it ...