Expand my Community achievements bar.

Issue with Simple chat sends Button.

Avatar

Level 2

-          How to control the size of button to make same as the input box, tried to override the button able to manage the width but height is fixed not getting changed

-          When I type something and press enter on key board it passes type message along with the default text “enter text here” . this behavior is not  repeating when I am clicking on send button. On send button click it working fine
Both enter and button click action calling following code

            override protected function sendNewMessage(p_evt:Event=null):void

            {

                  var message:String = _newMessage.text;  

                  if(_model.isSynchronized) {

                       

                        if (StringUtils.isEmpty(message)) {

                              return;    

                         }

                       

                        if(_sentQueue.length >= SENT_QUEUE_MAX_LENGTH) {

                              _sentQueue.pop();

                        }

                        _sentQueue.unshift(message);

                        _sentQueueCurrentIndex = -1;

                       

                        var msg:ChatMessageDescriptor = new ChatMessageDescriptor(message);

                        msg.color = _colorPicker.selectedColor;

                                               

                        if (_toCombo.selectedItem.userID!=null) {

                              msg.recipient = _toCombo.selectedItem.userID;

                              msg.recipientDisplayName = _toCombo.selectedItem.displayName;

                        } else {

                              msg.role = UserRoles.VIEWER;

                        }

                        _model.sendMessage(msg);

                        this._newMessage.htmlText = "<font color=\"#333333\"><i>"+_lm.getString("Enter chat here")+"</i></font>";

     

                        notifyUsersCheck();

                       

                  }

         }

1 Reply

Avatar

Former Community Member

Hi,

To Control the height, you should look at the updateDisplayList function inside SimpleChat.as , the height of sendButton is set to 47, if you override that function and put your own height , you should be fine. If you are linking to source, you can modify the source directly.

Regarding enter , I am not able to reproduce what you said, when I ran your sendNewMessage function except that "enter chat here" text is always there in the textinput and that’s because you added that line in your function.

Hope this helps

Thanks

Regards

Hironmay Basu