0 Replies Latest reply on Nov 28, 2012 11:10 AM by Interneers

    TextArea sizing issue

    Interneers

      *** Update

       

      Ok so further to this I thought I would try and reproduce this in a new App and see if the issue persists, of course it didnt and I could get a full size TextArea using any method, Bindable, create, preintialize, text="{data}" etc etc, so after much deliberation and thought, I looked back at the code in my App, leading me too the first View I created, this is kind of a login screen, so I did not want to show the program tabs until login was complete, so I created a two tab View, Login and Help, after successful login I used this code to rebuild the TabbedNavigator,

       

      First Tab, after successful login confirmation.

      FlexGlobals.topLevelApplication.reloadMain();
      

       

      reloadMain function in (default package)

      var vn1:ViewNavigator = new ViewNavigator();
      vn1.firstView = views.A;
      vn1.label = "A";
      vn1.percentWidth=100;
      
      var vn2:ViewNavigator = new ViewNavigator();
      vn2.firstView = views.B;
      vn2.label = "B";
      vn2.percentWidth=100;
      
      var vn3:ViewNavigator = new ViewNavigator();
      vn3.firstView = views.C;
      vn3.label = "C";
      vn3.percentWidth=100;
      
      this.tabbedNavigator.removeAll();
      //Bug - credit for fix: Dynamic_Internet_Dev and thread: http://forums.adobe.com/message/3702163
      this.tabbedNavigator.validateNow();
      this.tabbedNavigator.addItem(vn1);
      this.tabbedNavigator.addItem(vn2);
      this.tabbedNavigator.addItem(vn3);
      

       

      After re-jigging the code to bypass this swap of Tabs, the *#!*ing thing worked, so what have I learned obviously you take a risk using other peoples code, but I dont reinvent the wheel everytime I buy a new car! and probably wont stop recycling code that I find or have already generated myself.

       

      So without further ado I need to alter the App to not use this method, maybe hiding the Tabbar until login complete, will wait and see what else I can screw up...

       

      *** End of Update

       

      Hi,

       

      I have been running round in circles with this issue, I have an App that like most has a list followed by a detail page, the detail page is trying to display text, having read HTML is not recommended to be displayed, I revert ro plain text.

       

      This text is collected by the list and passed to the detail, I use data to access each value, all works fine, I have put a preinitialize and oncreate in the View tag, both of these create the string, fantastic.

       

      My issue is displaying the string, I have a TextArea, no border or background to make it look plain, I need it to fill available screen area, there is a Navigation and a Tab bar, so I set width and height to 100%, also if there turns out to be more text than can be displayed it should scroll, basic TextArea functionality.

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
              xmlns:s="library://ns.adobe.com/flex/spark"
              title="{data.Type}"
              creationComplete="view1_creationCompleteHandler(event)">
          <fx:Script>
              <![CDATA[
                  import mx.events.FlexEvent;
                  
                  protected function button1_clickHandler(event:MouseEvent):void
                  {
                      navigator.popView();
                  }
      
                  [Bindable]
                  public var label:String;
      
                  protected function view1_creationCompleteHandler(event:FlexEvent):void
                  {
                      label = data.Type;
                      if (data.Type != "N") {
                          label = label + "   " + data.A+ data.B+ "/" + data.C+ "\n\n";
                      } else {
                          label = label + "\n\n";
                      }
      
                      while (data.D.length < 3) data.D= "0" + data.D;
                      if (data.E.length > 1) 
                      {
                          label = label + "E: " + data.E+ "\n\n";
                      }                
                  }
       ]]>
          </fx:Script>
          <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
          </fx:Declarations>
          <s:navigationContent>
              <s:Button label="Back" click="button1_clickHandler(event)"/>
          </s:navigationContent>
          <s:TextArea id="type" width="100%" height="100%" editable="false"
                              fontSize="11" text="{label}" contentBackgroundAlpha="0" contentBackgroundColor="0xffffff" borderVisible="false" />
      
      </s:View>
      

       

      It does not expand the TextArea to fill the available space, it shrinks to the size when I first dragged it on the design, completely ignoring the height="100%", oh it also ignores, top, bottom, right and left which I have set to "0".

       

      The more annoying things is when I create a view exactly the same with a plain string created in the Script block and set Bindable without the preinitialize or creationcomplete it does as I need, the text however needs to be 'built' from the data. At some point I need to access the data and compile the string using values within the data. The compiler fails when I try using the method below to access data.

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
              xmlns:s="library://ns.adobe.com/flex/spark" title="Tab 1">
          <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
          </fx:Declarations>
          <fx:Script>
              <![CDATA[
                  [Bindable]
                  public var textToShow:String = "Lorem ipsum dolor sit amet, consectetur adipisicing cepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.... etc to make sure it requires to scroll";
      
              ]]>
          </fx:Script>
          <s:TextArea x="0" y="0" width="100%" height="100%" text="{textToShow}" borderVisible="false" contentBackgroundAlpha="0" contentBackgroundColor="0xffffff" fontSize="11"/>
      </s:View>
      

       

      Any pointers on how to make sure the TextArea is 100% after creating a string in preinitialize or a any other time would be greatly appreciated. Apologies if any errors in the code I copied and pasted, and removed a large amount of text manipulation to save space etc.

       

      With thanks

       

      Jacko