Announcement

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

    What is the auto child name for a StaticTextItem's canvas?

    SmartGWT 4.1p 5/19/2014

    I have a static text item that pops up a dialog on click. I want to change the cursor of just this item to a pointer on hover so the user gets additional visual feedback that it's clickable. I can't find in any docs a list of auto child names for objects that utilize them. The auto child doc is helpful but also doesn't contain a comprehensive list. Can you tell me what name to use? Is there somewhere I can find these names in the future?
    Thanks!

    Example:
    Code:
    StaticTextItem test = new StaticTextItem("test");
    
    test.setValue("<u>Click Me</u>");
    test.addClickHandler(new ClickHandler()
    {
          @Override
          public void onClick(ClickEvent event)
          {
              //open dialog
          }      
    });
    
    Canvas autoChild = new Canvas();
    autoChild.setCursor(Cursor.POINTER);
    
    test.setAutoChildProperties("???", autoChild);

    #2
    If you search the docs for any particular class with the phrase "autoChild", you will hit all the AutoChildren.

    StaticTextItem does not have any autoChildren. If you wanted to add a clickable area, we'd recommend just adding a FormItemIcon, which will already have a cursor indicating interactivity. If that's somehow not enough, use CanvasItem to embed your own Canvas.

    Comment


      #3
      Oh, ok. Any reason why the APIs for StaticTextItem show a changeAutoChildDefaults method?

      Comment


        #4
        Because AutoChildren could be added in the future or in a subclass.

        Comment


          #5
          Unfortunately I need text there and not an icon. If FormItemIcon allowed text (standalone or alongside an icon) I could use that.

          I've worked with CanvasItem before, and it looks like I'll have to go that route, but I must say it's a bit of overkill just to be able to apply a Cursor.

          StaticTextItem content is wrapped in a <div> so it should be doable to add a setCursor method in the future - that would be nice. :)

          Comment


            #6
            If you are trying to create clickable text, it seems that you are re-inventing ButtonItem or LinkItem.

            Comment


              #7
              Uhhh...crap. I didn't know about those. I was looking only at the list of classes that directly inherit FormItem. Thanks!

              Comment

              Working...
              X