[Google Wave APIs] Re: Not possible to delete image element?
I noticed that somehow the loop seems to stops at the point where it should delete the Image Element: else if ( e.getType() == EventType.FORM_BUTTON_CLICKED) { if (e.getButtonName().equals(button)) { Blip b = e.getBlip(); TextView textView = b.getDocument(); ListElement elems = textView.getElements(); textView.append(Number of Elements: +elems.size()+\n); for ( int i=0; ielems.size(); i++ ){ textView.append(i+ : ); int pos = textView.getPosition(elems.get(i)); textView.deleteElement(pos); textView.append(Element of Type + elems.get(i).getType () + deleted.\n); } textView.append(\nDone); } Output is: Number of Elements: 2 0 : Element of Type BUTTON deleted. 1 : Hope somebody knows what's wrong...I would really need that feature for my project. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Wave API group. To post to this group, send email to google-wave-api@googlegroups.com To unsubscribe from this group, send email to google-wave-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en -~--~~~~--~~--~--~---
[Google Wave APIs] Re: Not possible to delete image element?
Hi, I believe the problem is that you are trying to delete element using absolute index position. The moment you delete the first element in your loop, the absolute positions for the other elements have changed as a result. This is why the subsequent deletion would fail. If you want to delete all the elements of a blip, you can use the delete() method from TextView. Hope it helps, Austin On Fri, Oct 16, 2009 at 10:33 AM, Linc ala...@online.de wrote: I noticed that somehow the loop seems to stops at the point where it should delete the Image Element: else if ( e.getType() == EventType.FORM_BUTTON_CLICKED) { if (e.getButtonName().equals(button)) { Blip b = e.getBlip(); TextView textView = b.getDocument(); ListElement elems = textView.getElements(); textView.append(Number of Elements: +elems.size()+\n); for ( int i=0; ielems.size(); i++ ){ textView.append(i+ : ); int pos = textView.getPosition(elems.get(i)); textView.deleteElement(pos); textView.append(Element of Type + elems.get(i).getType () + deleted.\n); } textView.append(\nDone); } Output is: Number of Elements: 2 0 : Element of Type BUTTON deleted. 1 : Hope somebody knows what's wrong...I would really need that feature for my project. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Wave API group. To post to this group, send email to google-wave-api@googlegroups.com To unsubscribe from this group, send email to google-wave-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en -~--~~~~--~~--~--~---
[Google Wave APIs] Re: Not possible to delete image element?
Ok... This could happen, true. But in my case the first elemet it finds is the last inserted Button. The element before is the Image I want to delete. So deleting the button wouldn't change the absolute position of the image, right? But anyways, if I make a check if the element is an image before deleting it, it doesn't work too. (And there are only two elements in the Blip: the image and the button) You proposed to use delete(), but doesn't that also delete the Text? Not really my intention. Although I could save the text before using and restore it, but that would probably cause problems when I want to reinsert things at the former position(s) of the images. I appreciate your help, Lincoln --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Wave API group. To post to this group, send email to google-wave-api@googlegroups.com To unsubscribe from this group, send email to google-wave-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en -~--~~~~--~~--~--~---
[Google Wave APIs] Re: Not possible to delete image element?
Hi Lincoln, I wrote a quick sample and I think there might be a bug with deleting image element. I will file an bug for this. Thanks for the report :) Austin On Fri, Oct 16, 2009 at 1:00 PM, Linc ala...@online.de wrote: Ok... This could happen, true. But in my case the first elemet it finds is the last inserted Button. The element before is the Image I want to delete. So deleting the button wouldn't change the absolute position of the image, right? But anyways, if I make a check if the element is an image before deleting it, it doesn't work too. (And there are only two elements in the Blip: the image and the button) You proposed to use delete(), but doesn't that also delete the Text? Not really my intention. Although I could save the text before using and restore it, but that would probably cause problems when I want to reinsert things at the former position(s) of the images. I appreciate your help, Lincoln --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Wave API group. To post to this group, send email to google-wave-api@googlegroups.com To unsubscribe from this group, send email to google-wave-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en -~--~~~~--~~--~--~---
[Google Wave APIs] Re: Not possible to delete image element?
Ok thank you! Hopefully someone can fix it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Wave API group. To post to this group, send email to google-wave-api@googlegroups.com To unsubscribe from this group, send email to google-wave-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en -~--~~~~--~~--~--~---