| 03-19-2010, 05:55 AM | #1 |
Is this bugged? When I try to reference GetClickedButton/Dialog() through a callback registered using the function TriggerRegisterDialogButtonEvent both return null values. Here's some crappy code that will show you what I'm referring to: JASS:scope MenuLib initializer init public function buttonevent takes nothing returns nothing call BJDebugMsg(I2S(GetHandleId(GetClickedButton()))) endfunction public function initdelayed takes nothing returns nothing local trigger t=CreateTrigger() local dialog d=DialogCreate() local button ditem=DialogAddButton(d, "|cffffccW|rhat?", 'w') call TriggerRegisterDialogButtonEvent(t, ditem) call TriggerAddAction(t, function buttonevent) call DialogSetMessage(d, "Message!") call DialogDisplay(Player(0), d, true) endfunction public function init takes nothing returns nothing call TimerStart(CreateTimer(), 0, false, function initdelayed) endfunction endscope |
| 03-19-2010, 10:32 PM | #2 |
Try this instead: JASS:call TriggerRegisterDialogEvent(t,d) I don't think GetClickedButton() refers to the dialog button event, oddly enough. |
| 03-20-2010, 02:34 AM | #3 |
Actually, neither GetClickedDialog() or GetClickedButton() work in the above code, and TriggerRegisterDialogEvent works fine --I know how to get around the problem but I honestly wasn't aware that this event didn't work. If you change what I posted to display the handle-ID of GetClickedDialog() instead of the clicked button, you will see that it still displays 0. |
| 03-20-2010, 03:48 AM | #4 | |
Quote:
Yeah, I guess Blizzard just made one of those weird events. GetClickedDialog/Button() only corresponds to the TriggerRegisterDialogEvent(). That must be the reason why Blizz only has that event in GUI and excluded adding the other. They both register the same event, but one allows you to refer to the dialogs/buttons and one doesn't. Well, you probably know all this but I'm just mentioning it anyway for those reading the thread who don't want to go out and test it. |
