Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    addDropHandler problem after upgrading to SmartGwt2.2

    Hi all.

    I have some Canvas object called img and I assigned to it DropEvent.

    img.addDropHandler(new DropHandler() {

    @Override
    public void onDrop(DropEvent event) {
    Window.alert("Drop");
    }
    });

    Since I had used SmartGwt2.1 version it works, after ugrading to 2.2 nope :(.
    Thanks for any help.

    #2
    Can you post a standalone test case? Modifying a showcase example can't reproduce it.

    Comment


      #3
      private Img deleteImage = new Img("kosz.png", 42, 46);

      deleteImage.setCanAcceptDrop(true);
      deleteImage.setDropTypes("type");

      deleteImage.addDropOverHandler(new DropOverHandler() {
      @Override
      public void onDropOver(DropOverEvent event) {
      deleteImage.setBorder("2px solid red");
      }
      });

      deleteImage.addDropOutHandler(new DropOutHandler() {
      @Override
      public void onDropOut(DropOutEvent event) {
      deleteImage.setBorder("");
      }
      });

      deleteImage.addDropHandler(new DropHandler() {
      @Override
      public void onDrop(DropEvent event) {
      Window.alert("Drop");
      }
      });

      DropOverEvent and DropOutEvent are working well

      Comment


        #4
        Clearly something else is going on then since this minimal code on the latest version works without issue.
        Code:
        public void onModuleLoad() {  
        	 VLayout l = new VLayout();
        	 Img moveImage = new Img("myImage.png");
        	 moveImage.setCanDrag(true);
        	 moveImage.setCanDrop(true);
        	 moveImage.setDragType("type");
        	 
        	 Img deleteImage = new Img("myImage.png");
        	 deleteImage.setCanAcceptDrop(true);
        	 deleteImage.setDropTypes("type");
        	 deleteImage.addDropHandler(new DropHandler() {
        		 @Override
        		 public void onDrop(DropEvent event) {
        			 SC.say("Drop");
        		 }
        	 });
        	 l.addMember(moveImage);
        	 l.addMember(deleteImage);
        	 l.draw();
         }

        Comment


          #5
          add DropHandler to a HLayout

          Hi
          i try to add a dropHandler to a HLayout wit hthe following code.


          m_oButtonHLayout.setCanAcceptDrop(true);
          m_oButtonHLayout.addDropHandler(new DropHandler() {
          @Override
          public void onDrop(DropEvent event) {
          SC.say(m_oMessages.getTitleNote(),
          m_oMessages.getDropArea());
          }
          });

          But i don't receive the drop event. i tried to define the setDragType("type"), but this even didn't help...
          can smoebody tell me what i forgot?

          best thanks for every hint.
          lmedici

          Comment

          Working...
          X