• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[General] How to delete a button from a dialogue

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,338
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,338
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,338
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,338
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