/// <summary> /// OnMessage() This method gets called when there's a new message. /// Controls send messages to notify their parents about their state (changes) /// By overriding this method a control can respond to the messages of its controls /// </summary> /// <param name="message">message : contains the message</param> /// <returns>true if the message was handled, false if it wasnt</returns> public override bool OnMessage(GUIMessage message) { // Let the spin control handle messages first if (_spinControl.OnMessage(message)) { return(true); } // Handle the GUI_MSG_LABEL_SET message if (message.TargetControlId == GetID) { if (message.Message == GUIMessage.MessageType.GUI_MSG_LABEL_SET) { if (message.Label != null) { Label = message.Label; } return(true); } } // Handle the GUI_MSG_CLICKED messages from my spincontrol // When the user has requested that the spin text should be rendered in the label text we listen for clicks on the // spincontrol and update the button label when a change is detected. if (_spinTextInButton) { if ((message.TargetControlId == GetID) & (message.Message == GUIMessage.MessageType.GUI_MSG_CLICKED)) { Label = _spinControl.GetLabel(); return(true); } } // Let the base class handle the other messages if (base.OnMessage(message)) { return(true); } return(false); }