Delete window/label?

Nyyrazzilyss
Posts: 334
Joined: Thu Mar 05, 2015 2:53 am

Delete window/label?

Post 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.

User avatar
Akaya
Posts: 414
Joined: Thu Apr 19, 2012 1:36 am

Re: Delete window/label?

Post 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?

Nyyrazzilyss
Posts: 334
Joined: Thu Mar 05, 2015 2:53 am

Re: Delete window/label?

Post by Nyyrazzilyss »

Screenshot, NyyLIB
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)

User avatar
SlySven
Posts: 1034
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Delete window/label?

Post 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.

User avatar
Akaya
Posts: 414
Joined: Thu Apr 19, 2012 1:36 am

Re: Delete window/label?

Post 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.

Nyyrazzilyss
Posts: 334
Joined: Thu Mar 05, 2015 2:53 am

Re: Delete window/label?

Post 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.

Garagoth
Posts: 6
Joined: Thu Jan 24, 2013 7:24 am

Re: Delete window/label?

Post 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).

Jor'Mox
Posts: 1153
Joined: Wed Apr 03, 2013 2:19 am

Re: Delete window/label?

Post 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.

User avatar
Vadi
Posts: 5048
Joined: Sat Mar 14, 2009 3:13 pm

Re: Delete window/label?

Post 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?

User avatar
SlySven
Posts: 1034
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Delete window/label?

Post by SlySven »

I thought I had prototyped some C++ code to proved a deleteLabel() Lua command - but I cannot currently find it :sad:...

Post Reply