Announcement

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

    Resize bar Custom Handling


    I am using <smartgwt.version>12.1-p20210219</smartgwt.version>

    I am using the setShowResizeBar on the layout to show a split bar and I have set the Visibility as Hidden to show it in the closed state allowing the user to explicitly click to view it.

    Now, I want that if the user once opens the split bar and move to another tab of the tabset. Once he is back on the screen the split bar should remain open and vice versa.

    Is there is any way to achieve this?


    Click image for larger version

Name:	bar.png
Views:	63
Size:	524 Bytes
ID:	266308

    Or any way to get the split bar icon button so that I can add a kind of click handler on the Icon to trigger some function.

    #2
    Normally, if you go back and forth between tabs, the shown/hidden state of components in the tab is automatically preserved. Your results imply that you may be re-creating the contents of the tab every time the tab is selected. You probably don’t want to do this, although in rare cases it could make sense.

    If you want to continue with the same approach, then you could use a VisibilityChanged handler on the target and store it’s shown/hidden state, and use that when recreating the tab contents.

    Comment


      #3
      I have tried the approach suggested, VisibilityChanged Handler get called even when I am switching from the tab with resize bar to the other.Any way to get onClick event for splitbar.

      Comment


        #4
        If it's not clear why that would be happening, you can use traceLogMessage to figure out why, and then ignore the notification selectively.

        The Splitbar's has a "grip" autochild where you could add a click handler, but that is more complicated approach than what we have already provided.

        Comment


          #5
          Can you please provide the reference to the "grip" autochild method. For achieving the same I have created a superclass of the Splitbar class.

          @BeanFactory.Generate
          public class Bar extends Splitbar {

          public Bar() {
          setVResizeCursor(Cursor.HAND);
          setHResizeCursor(Cursor.HAND);
          setResizeBarTarget("next");
          getShowGrip();
          }
          }

          And I have setted the bar in the view where I have setted showResizeBar to true.

          final Bar bar = new Bar();
          setResizeBarClass(Bar.class.getName());
          setAutoChildProperties("resizeBar", bar);



          Comment


            #6
            Again, this approach is unnecessary and less complicated than the two other approaches we have already explained.

            But for others who might need it, now you need a call to setAutoChildProperties("grip", ...) to add a click handler.

            At this point, we need to stop responding on this thread because you are ignoring good advice and then asking for help with poor approaches. Consider purchasing hourly help (Consulting) if you want to continue in this way.

            Comment

            Working...
            X