• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[General] How to delete a button from a dialogue

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,337
Hi,

I see you can add buttons to a dialogue, but how do you remove them?

Or do I have to remake the dialogue each time I want to remove a button?
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
So dialog.DialogClear() removes all of its buttons, but the dialog still exists (i.e. I don't have to destroy it and then remake it)?

If I have an array of those buttons, will they get deleted?

Also, if I destroy a dialogue, but still have an array of its buttons, do those still exist?
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
All of the buttons in the dialog will get removed. The array if it points to those that were deleted will point to nothing anymore.

When destroying a dialog it destroys all buttons along with it. The array will point to nothing. ( don't forget to null the array to get back the lost handles.)

Null the entire array in both cases, or null each of its entries?
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
Just to summarize my understanding, I should do this in both cases?

JASS:
call DialogDestroy(myDialog)
for i range 0 to size of myBttns
  set myBttns[i] = null
endfor
set myBttns = null
...

JASS:
call DialogClear(myDialog)
for i range 0 to size of myBttns
  set myBttns[i] = null
endfor
set myBttns = null
...
 
Status
Not open for further replies.
Top