Disclosure panel open/close events fire before the widget is actually opened or closed

239 views
Skip to first unread message

Rasha ElSayed

unread,
Sep 19, 2012, 4:18:30 AM9/19/12
to google-we...@googlegroups.com
Hi all,

I am using Disclosure panel in my project and on open/close, I do some layout calculations in which I need the height of the panel.

My code is something like this
disclosurePanel.addOpenHandler(new OpenHandler<DisclosurePanel>() {
        @Override
        public void onOpen(OpenEvent<DisclosurePanel> arg0) {
           adjustPageLayout(pageLayout);
        }
      });

The problem is that the open event is fired before the disclosure panel is actually opened, which means that the height of the panel is still as if it is closed (Header-only height). This gives me wrong numbers when I call adjustPageLayout

Any idea how to deal with this?

Best regards,
Rasha 

Patrick Tucker

unread,
Sep 19, 2012, 10:09:10 AM9/19/12
to google-we...@googlegroups.com
Looks like fireEvents() should be moved to the animation's onComplete().  Have you checked the issue tracker for a similar report?  It might be worth filing one if there is not already an issure for this.
 
No that this is a good solution, but have you tried using a DeferredCommand?

Rasha ElSayed

unread,
Sep 21, 2012, 5:40:30 PM9/21/12
to google-we...@googlegroups.com
Thanks for replying

Yes I have tried Deferred command but it gives the same effect, or may be I use it in a wrong way? I schedule it inside the event handler, is this the right place?
disclosurePanel.addOpenHandler(new OpenHandler<DisclosurePanel>() {
        @Override
        public void onOpen(OpenEvent<DisclosurePanel> arg0) {
           scheduleCommand();
        }
      });

private void scheduleCommand() {
    DeferredCommand.addCommand(new Command() {
      public void execute() {
        adjustLayout();   
      }
    });
  }


I checked the issue tracker, and there is an issue planned for the next release.

Regards
Rasha 
Reply all
Reply to author
Forward
0 new messages