TiSMSView icon indicating copy to clipboard operation
TiSMSView copied to clipboard

Include source message view in the message click event

Open sindresorhus opened this issue 13 years ago • 3 comments

Can you include the source view of the message in the event object of the message click event?

On iPad OptionDialog needs a source view to know where to place the OptionDialog popover. I'm showing a OptionDialog when a message is clicked. I tried using event.source, but it seems to be the source view of the message table.

sindresorhus avatar Sep 16 '11 22:09 sindresorhus

Not really sure what you mean... could you provide some code? Also, this is right now an iPhone only module, I have not tested it on the iPad, and I'm afraid to see how it would look like :)

On a later version I will include support for iPad.

pec1985 avatar Sep 16 '11 23:09 pec1985

Example code:

var messageActionDialog = Ti.UI.createOptionDialog({
    options: ['Copy', 'Cancel'],
    cancel: 1
});

textArea.addEventListener('messageClicked', function(e) {
    if ( e.text ) {
        messageActionDialog.show({
            view: e.source
        });
    }
});

The event object I get when clicking a message now is:

{

    source = "[object TiPedroSMSView]";

    text = "test\n";

    type = messageClicked;

    where = message;

}

What I need is a reference to the message view, so I can put it into the view property of the .show() method of the OptionDialog. OptionDialog needs this property to know where to place the popover on iPad.

The source property should point to the message view ([object TiPedroSMSMessageView]?) and not the whole view.

The event object should also be documented.


Also, this is right now an iPhone only module, I have not tested it on the iPad, and I'm afraid to see how it would look like :)

In portrait on iPad it works perfectly, but in landscape the textArea toolbar disappears.

sindresorhus avatar Sep 17 '11 00:09 sindresorhus

Not sure if this is possible, will look into it next weekend.

pec1985 avatar Sep 18 '11 04:09 pec1985