pec1985 / TiSMSView

Expandable Text Area Module - iOS - Titanium
Other
60 stars 18 forks source link

Include source message view in the message click event #9

Open sindresorhus opened 13 years ago

sindresorhus commented 13 years ago

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.

pec1985 commented 13 years ago

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.

sindresorhus commented 13 years ago

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.

pec1985 commented 13 years ago

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