• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Change Dialog Button Text?

Status
Not open for further replies.
Level 4
Joined
Jun 10, 2007
Messages
46
If I have a dialog button stored in a variable, is it possible to change its text without creating a new button? I can't find a function in the API that would do this.

Would prefer a GUI solution but I have no problems with a simple and understandable JASS solution.
 
Level 13
Joined
Mar 24, 2010
Messages
950
Yeah its easy to change the text of a button, like this.

  • Dialog - Create a dialog button for Menu labelled Text you want
  • Set Button = (Last created dialog Button)
whenever you wanna change the text of the button just do it this way.

If you wanna change the test in a menu already made later on, you may have to clear it and just rebuild it then changing that text of that button you want.
 
Level 4
Joined
Jun 10, 2007
Messages
46
Yeah its easy to change the text of a button, like this.

  • Dialog - Create a dialog button for Menu labelled Text you want
  • Set Button = (Last created dialog Button)
whenever you wanna change the text of the button just do it this way.

If you wanna change the test in a menu already made later on, you may have to clear it and just rebuild it then changing that text of that button you want.

There's a lot of reasons doing that would be bad, memory leaks are the least of them.

I believe this will work:
JASS:
native DialogSetMessage takes dialog whichDialog, string messageText returns nothing
Ex:
JASS:
call DialogSetMessage( udg_DIALOGNAME, "STRING" )

Right idea, but I need to change a button's text.

I'm working on a Spell Copy interface, where a unit can learn one spell that other units cast in the game, and want to change the text of the button dynamically whenever I feel like it. Right now I'm just deleting the button and replacing it with a new one, then updating variables, which seems more cumbersome than it ought to be.

So yeah, any solutions you guys know of would be appreciated.
 
Status
Not open for further replies.
Top