Announcement

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

    Vertically center a label on ToolStrip

    I have toolStrip created, added a label to it, but I can't get it vertically centered (please see attached screenshot). I set the alignments both horizontally and vertically to CENTER with the following code on toolStrip.

    Code:
            setAlign(VerticalAlignment.CENTER);
            setAlign(Alignment.CENTER);
    HTML from firebug is here
    Code:
    <div onscroll="return isc_WidgetCanvas_0.$lh()" style="position: absolute; left: 1187px; top: 0px; width: 100px; height: 30px; z-index: 200342; -moz-box-sizing: border-box; overflow: hidden; cursor: default;" class="normal" eventproxy="isc_WidgetCanvas_0" id="isc_10">
     <div style="POSITION:relative;VISIBILITY:inherit;Z-INDEX:200342;CURSOR:default;" eventproxy="isc_WidgetCanvas_0" id="isc_11">
      <div id="isc_WidgetCanvas_0_widget" style="width:100%;height:100%">
       <div class="gwt-Label">Detail Display:</div>
    </div></div></div>
    Can you please help?
    Attached Files

    #2
    The label is filling the vertical space, so centering does nothing. To fix, set the Label to a minimum height (like 1 pixel) and it will autofit to the text.

    In the future, you can use the Watch tab in the Developer Console to see component sizes and understand what's happening in a scenario like this.

    Comment


      #3
      Thanks for the quick response. That works!

      Comment


        #4
        Followup question on smartclient developer console. I have no problem starting it in my test environment. But when I integrated with our existing webapp, I got javascript error saying 'isc' is undefined.

        The setup is like this, I have a JSP that loads our usual header/footer of the webapp then within it I have an iframe that loads another jsp that loads all the smartgwt scripts. The 2 JSPs are on the same folder.

        I am guessing it's because my parent JSP is missing some scripting loading, or variable settings. Can you point me to the right direction?

        Comment


          #5
          If you're loading the SmartGWT logic in a frame, the 'isc' variable is only going to be available in the scope of that frame.

          You would still be able to launch the developer console using the java method in your source if you want to map some key combination to show the developer console (as we do with our showcase examples), but a standard javascript evaluation of "isc.showConsole()" will not work as that code would run in the scope of the top level window where isc is not loaded.
          Instead you'd want to explicitly indicate the frame - something like window.frames['frameName'].isc.showConsole() should work.

          Comment


            #6
            This is wonderful, it can actually debug in real system now. Thanks.

            One more question, I only need the developer console for a production system. Is there a way to select just that from the tool set for deployment.

            Comment


              #7
              Including the tools module doesn't bring in anything you wouldn't want in production.

              If you also include the EE tools module for tools such as Admin Console, be sure to password protect the tools/ directory so that only admins have access.

              Comment

              Working...
              X