How to get the label of parent container?

Hi
I have a Canvas, Its label is "News".
I added a text control in it and i want to set its text
dynamically from the canvas label.
But i dont know how to access the label of the Canvas
"without" using the id of the canvas.
like
<mx:Canvas label="News">
<mx:Text text="{parent.label}"/>
</mx:Canvas>
Please guide me to achieve the above thing.
Thanks in advance

"manofspirit" <[email protected]> wrote in
message
news:garoob$lqh$[email protected]..
> Thanks for the reply Amy
> But I dont have any idea about sub-classing!
> Please put some light on this concept.
> Thanks
Say you have an application
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
xmlns:mm="com.magnoliamultimedia.*"
layout="absolute">
<mx:Canvas label="foo">
<mm:ParentLabelText width="100" height="25" />
</mx:Canvas>
</mx:Application>
If you have a directory com that has a directory
magnoliamultimedia in it,
then if it has this file, you should see "foo" on the screen
when you run
that application:
<?xml version="1.0" encoding="utf-8"?>
<mx:Text xmlns:mx="
http://www.adobe.com/2006/mxml"
creationComplete="init()">
<mx:Script>
<![CDATA[
private function init():void{
if (parent.hasOwnProperty('label')){
text=parent['label'];
} else {
text='parent has no label property';
]]>
</mx:Script>
</mx:Text>
HTH;
Amy

Similar Messages

  • How to get the label on selectOneMenu selected item??

    Hi,
    I'm not able to get the label of the selected item in a selectOneMenu. The code I use to fill it is:
    <h:form id="formNacion" name="formNacion">
    <h:selectOneMenu value="#{modelRtbBean.nacion}" id="selectNacion" onchange="this.form.submit();">
    <f:selectItems value="#{dataRecoveryBean.naciones}" id="idItemsNacion"/>
    </h:selectOneMenu>
    </h:form>
    The dataRecoveryBean has this method to fill the content of the component (basically it creates an arrayList of selectItems by recovering data from a database):
    public ArrayList<SelectItem> getNaciones() {
    if ((naciones == null ) || (naciones.isEmpty()) ){
    naciones = new ArrayList<SelectItem>();
    HDBGeografico hdbGeo = new HDBGeografico();
    SqlMadd sqlmadd = new SqlMadd();
    try {
    AccessBD sscm = new AccessBD( );
    sscm.table(hdbGeo.getSqlNaci());
    // The AccessBD object has a reference to the resultset:
    ResultSet rs = sscm.getRS();
    while (rs.next()) {
    naciones.add(new SelectItem((String) rs.getString(1), (String) rs.getString(2)));
    sscm.Close();
    } catch (Exception e) {
    System.out.println(e.toString());
    return naciones;
    the modelRtbBean setNacion recovers the value, but I need its label too, because it's a kind of description that I use later.
    In the modelRtbBean setNacion method I'm able to access the UISelectItems object, but I cannot get the selected item itself
    public void setNacion(String nacion) {
    FacesContext fc = FacesContext.getCurrentInstance();
    if (fc != null) {
    UIViewRoot viewRoot= fc.getViewRoot();
    System.out.println(viewRoot.getViewId());
    HtmlSelectOneMenu selNac = (HtmlSelectOneMenu)viewRoot.findComponent("bodySTB:formNacion:selectNacion");
    if (selNac != null) {
    System.out.println("Nacion value-htmlSelectOneMenu :" + selNac.getValue() );
    System.out.println(selNac.getAccesskey() + selNac.getTitle() + selNac.toString());
    UISelectItems uis = (UISelectItems)selNac.findComponent("idItemsNacion");
    if (uis != null) {
    System.out.println("I have the element...");
    this.nacion = nacion;
    How could it be accessed this selected item label ??

    I finally did it as you suggest, but I found another way to access the label (I don't know if it could be useful for anybody but here it is) :
    In the setter method linked to the SelectOneMenu, you can put in this code:
    FacesContext fc = FacesContext.getCurrentInstance();
    if (fc != null) {
    UIViewRoot viewRoot= fc.getViewRoot();
    System.out.println(viewRoot.getViewId());
    HtmlSelectOneMenu sel = (HtmlSelectOneMenu)viewRoot.findComponent("viewName:formName:selectOneName");
    if (sel != null) {
    UISelectItems uis = (UISelectItems)sel.findComponent("idItemsName");
    if (uis != null) {
    ArrayList<SelectItem> listElem = (ArrayList<SelectItem>) uis.getValue();
    You could put in in the value item of each SelectItem it's index position in the list, so in the setter method
    of the bean linked to the selectOneMenu you would get the index of the selected item as the parameter of the method
    int index = 1; // For easyness in this example
    System.out.println("Label: " + listElem.get(index).getLabel() + " Value: "+ listElem.get(index).getValue());
    Thanks !!!

  • How do get the label id or label name of a filed's label?

    Hello everybody,
    I need your help for getting the name of id of label, this label belongs to a field in a form.
    When I create my javascript's function I could manipulate the visibility of a field with the next sentence:
    document.getElementById("P1_NAME_OF_FIELD").style.visibility = "visible";
    but I do not know to do the same thing with its label:
    Also, I have tried with the parentnode javascript attribute, this is because getting the parentnode ( a tag of TD ) but I don't have a good result.
    document.getElementById.parentNode.parentNode.style.visibility = "visible";
    I write twice parentnode because I found in the code that the label and the field are like this:
    <tr>
    <td> label </td>
    <td> text field </td>
    </tr>
    The first parent node is TD and the second corresponding to TR.
    After that I edit the item, in the label's part I wrote in Label:
    <div id="ID_LABEL" name="ID_LABEL" style="visibility:hidden"> Label </div>
    This was for assigning the id to the label and with this to identy easily.
    and in the element's part I wrote in 'HTML Table Cell Attributes'
    style = "visibility:hidden"
    And in the javascript function I wrote the next:
    document.getElementById("P1_NAME_OF_FIELD").style.visibility = "visible";
    document.getElementById("ID_LABEL").style.visibility = "visible";
    With this I could manipulate the visibility but the problem is that the font size of is not the same with the others labels.
    Could you help me with this problem?
    What and how do I must do in apex?
    Could you send me a page with relationated examples with this problem?
    Thank you.
    Best Regards.

    Long story short: A ColorModel is not a Color. It is an object containing information about how the colors in an object are described... or something like that.
    Component.getForeground() is probably want you want. It returns a Color object.
    http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Component.html#getForeground()

  • How to Get the schema name that contains the current procedure?

    I have try select sys_context( 'userenv', 'current_schema' ) from dual; but it returns the schema name of the login user. How to return the schema name of the procedure instead? For example, procedure A is in ControlDB, and I login as sys, when query procedure A it should return ControlDB instead of sys.
    I have searched in Google but no luck to find the answer so far, please help. Thank you

    It works!
    I am quite confused now. I did try to use select username from user_users in GetSchemaName procedure, but it always return the login user instead of the owner of the procedure. Why it return the procedure owner if I put the query inside a function then call it from the procedure?
    Is it because when the login user call the procedure and the procedure call the function, it's the procedure owner is calling the function so the user_users return the user that is calling it which is the procedure owner. And if the query is directly put inside the procedure, when the login user call the procedure, user_users return the login user directly? Does it imply that if the procedure call any function or other procedures etc, it would be the procedure's owner calling them instead of the login user?
    (sys_context works as well if I move the query into the function then call the function from the procedure)
    Cheers
    Message was edited by:
    user500168

  • How to get the label of the current active book or page

    response:
    response.getParameter("_pageLabel")
    Message was edited by gpedone at Sep 30, 2004 6:44 AM

    If within PageFlowController you can use corresponding backing context. However within jsp page, you need to use PresentationContext to get information about current book or page.
    Regards,
    Kail

  • How to get the parent of a component in fx?

    Here is an example:
    Index.fx:
    Stage {
        title: "Online book library";
        width: 1024
        height: 768
        scene:Scene {
        fill: Color.WHITE
        content: [
           banner ,
           login = Login{translateX:715 translateY:135}
    };Login.fx:
    var logOn : Button = Button {
            translateX:25 translateY: 170
            text: "Log On"
            font: Font {size:11 name: "Verdana Bold"}
            action: function() {
                showHello();
    function showHello(){
       // add a label in index.fx whose text is "welcome!";
        }I want to show something on the index.fx but I don't know how to get the parent from the child component?
    In Flex, we use parent or parentApplication, Is there a similar function in JavaFX?

    Reusing the same Tile example, I had no problems, I suppose I was doing wrong the first time:
    def IMAGES_WIDTH = 100;
    def IMAGES_HEIGHT = 100;
    var COLUMN_NB = 3;
    var ROW_NB = 3;
    var scene: Scene;
    var previews: Container;
    Stage
      title: "Test of Tile layout"
      scene: scene = Scene
        width: 500
        height: 500
        fill: Color.LAVENDER
        content:
          previews = Tile
            hgap: 10
            vgap: 10
            layoutX: bind (scene.width - previews.width) / 2
            layoutY: bind (scene.height - previews.height) / 2
            columns: COLUMN_NB
            content: for (i in [ 1 .. COLUMN_NB * ROW_NB ])
              ImageView
                id: "IV{i}"
                image: Image
                  url: "{__DIR__}clock.gif"
                  width: IMAGES_WIDTH
                  preserveRatio: true
                onMousePressed: Hide
    function Hide(evt: MouseEvent): Void
      println("{evt.node} ({evt.node.id}) - {evt.node.parent}");
      var nm: Node = evt.node.parent.lookup("IV5"); // Middle node
      nm.visible = false;
      var ntl: Node = evt.node.parent.lookup("IV1"); //Top left node
      (ntl as ImageView).viewport = Rectangle2D { height: IMAGES_WIDTH/2, width: IMAGES_WIDTH/2 };
      (evt.node.parent as Tile).hgap = 20; // Strange effect, but works
    }

  • How to get the parent window in sub-child controller class in javafx?

    how to get the parent window in sub-child controller class in javafx?

    You can get the window in which a node is contained with
    Window window = node.getScene().getWindow();Depending when this is invoked, you might want to check the Scene is not null before calling getWindow().
    If the window is a stage that is owned by another window, you can get the "parent" or "owner" window with
    Window owner = null ;
    if (window instanceof Stage) {
      Stage stage = (Stage) window ;
      owner = stage.getOwner();
    }

  • How to get the intersection of two arraylist containing user defined obj??

    How to get the intersection of two arraylist containing user defined obj??
    I can easily get the intersection of two array list which containing some simple class(Integer, String). But how to get the intersection of two arrayList which contain user defined object?
    Here is the sample code..I can not run this out...anybody can help me? thank you very much..
    The correct result should be like this:
    2
    2
    but I can only get this:
    2
    0
    import java.util.*;
    public class testRetain{
         public static void main(String[] args){
              ArrayList a = new ArrayList();
              ArrayList b = new ArrayList();
              a.add( new dog(1,2,2) );
              a.add( new dog(1,2,1) );
    System.out.println(a.size() );
              b.add( new dog(1,2,2) );
              a.retainAll(b);
    System.out.println(a.size() );
    class dog implements Comparable{     
         int head;
         int arms;
         int legs;
         dog(int head, int arms, int legs){
              this.head = head;
              this.arms = arms;
              this.legs = legs;
         public int compareTo(Object o){
              if ( ((dog)o).head > this.head )
                   return -1;
              else if ( ((dog)o).head < this.head )
                   return 1;
              else
                   return 0;
    }

    @Op. Your classes should override equals and hashCode
    Kaj

  • How to get the parent Frame of a component ?

    Hi,
    I'm wondering how to get the parent JFrame (or JDialog) of a component.
    Thanks for tips

    I'm using this code:
    public Component getFrame(Component comp)
        Component frame = comp;
        while ((frame != null) && !(frame instanceof Frame))
            frame = frame.getParent();
        if (frame == null)
            frame = comp;  // no parent found
        return frame;
    }

  • How do I get the Label for a Front Panel Control to appear in the Block Diagram but not on the Front Panel?

    How do I get the Label for a Front Panel Control to appear in the Block Diagram but not on the Front Panel? On the Front Panel I am making a complex control that consists of a Slider and a Numerical Input box. Both Controls display the same information and either can be used for Input. When one changs, the other is made to display the same value.
     But I only want the Slider to display the Label on the Front Panel, to avoid confusion. On the Block Diagram however, I want both controls to display their Labels so that I know what they are. How do I display the Label for a Control on the Block diagram, but not display its Label on the Front Panel?

    No.  The Label Visible property is separate for the front panel control label and the block diagram terminal label.
    How did you start out with the block diagram's label not being visible?  Whenever I drop a control or indicator, the label is always visible on both the FP and BD by default.  Maybe there is a LabVIEW option that causes new controls/indicators not to have their labels visible by default, but I have yet to find it.  I don't think an item should ever be dropped without the label visible, good LabVIEW coding practice demands that the labels for control terminals on the block diagram be visible so that you know what control or indicator a wire is going to.
    That being said, I have seen a lot of VI's posted where the label for the terminal on the BD is not shown (against good programming practice.)  I've gone to the BD and right clicked to show the label.  Sometimes, the people have an empty label (which will turn off the visibility for both the FP and BD) and I'm forced to add some text of my own into the label so I can figure out what their code is doing.  When I add some text to the label, at that time, I find both the BD and FP labels become visible.
    Are you dealing with controls that have empty labels to start?
    Good programming practices:
    1.  Always have a name for all of your controls, never use and empty label by deleting the text in the label.
    2.  Make the labels unique.  For example, don't have two controls both called Stop.  How do you know quickly know which terminal relates to which control?
    3.  Always show the labels on the block diagram, so you know the function of a control's terminal.  If you want to hide the label on the FP, that's okay.
    4.  If you want a different label to appear on the FP than whatever you actually called the control, then use the caption.  You can hide the label and show the caption.  This is useful if you need to programmatically change what the "label" is on the front panel such if you are making an application that needs to change its user interface such as for a foreign language.

  • [CS3] How to get the parent spread of a page?

    Hallo!
    I have the page UID.
    How to get the spread of this page?
    Thanks,
    Alois Blaimer

    You'll also need an IDataBase*, from any object in the same document.
    Then you can follow IID_IHIERARCHY one up to the kSpreadLayerBoss, two up to the kSpreadBoss or just refer to the hierarchy root.
    Dirk

  • IFrame(child container) still visible after closing the title window(parent container)

    Hi All ,
    I have created a sample project using a link button which when clicked opens up an TitleWindow which has an iframe and a text area in a hbox
    When you execute the application ,
              Click the link button
              The Popup window opens up showing the title window with the close button
              Click the close button of the title window
              The Title window is removed and the iframe and the text area are not visible
    Do this a couple of times
    You can notice that the iframe is still visible even when the title window is closed
    Can someone explain me how this issue can be resolved and also explain me why the iframe(child container) is still visible when the title window(parent container) is not visible. 
    Main Application file
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application
        width="100%" height="100%" creationPolicy="all"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical" creationComplete="init()"
        xmlns:containers="containers.*">
       <mx:Script>
       <![CDATA[
           import mx.managers.PopUpManager;
           import containers.PopUpBrowser;
           public function doRequest():void
                    var requestPopup:PopUpBrowser = PopUpManager.createPopUp(this, PopUpBrowser) as PopUpBrowser;
                    PopUpManager.addPopUp(requestPopup,this);
                    requestPopup.x = 220;
                    requestPopup.y = 50;
       ]]>
       </mx:Script>
       <mx:Text fontSize="14" fontWeight="bold" text="Click the link button below to open the Title Window" />
       <mx:Spacer height="100"/>
       <mx:LinkButton label="Click me" fontSize="16" fontWeight="bold" click="doRequest()"/>
    </mx:Application>
    PopUpBrowser.mxml Component
    <?xml version="1.0" encoding="utf-8"?>
    <mx:TitleWindow
        xmlns:mx="http://www.adobe.com/2006/mxml"
        close="removeMe()"
        showCloseButton="true"
        styleName="myTitleWindowStyle"
        width="850" height="500"
        title="Klout User Profile"
        paddingTop="1" paddingBottom="1"
        paddingLeft="1" paddingRight="1"
        xmlns:generic="com.serendio.voom.components.generic.*"
        xmlns:flexiframe="http://code.google.com/p/flex-iframe/"
        horizontalScrollPolicy="off"
        verticalScrollPolicy="off" >
        <mx:Script>
            <![CDATA[
                import mx.managers.PopUpManager;
                public function removeMe():void
                    PopUpManager.removePopUp(this);
            ]]>
        </mx:Script>
        <mx:HBox width="100%" height="100%">
        <flexiframe:IFrame source="http://www.google.com" id="iFrame" width="50%" height="100%"/>
        <mx:TextArea text="Open and close the title window few times and watch the iframe remain visible even when the title window is closed"
             fontSize="14" width="50%" height="80%"/>
        </mx:HBox>
    </mx:TitleWindow>
    Thanks,
    Ajantha

    Hey,
    This is working fine for me with the current 4.5 Flex, Firefox 3.6.12, IE8. On what browser you are getting this error.
    Thanks,
    Jayagopal.

  • How to get the enclosing folder of an Application?

    Ok. re-visiting my Applescript to compare installed apps versus a list of predefined apps... here is my test code so far:
    set appsPath to (path to applications folder)
    tell application "Finder"
      set appList to name of every application file of entire contents of folder appsPath
    end tell
    set theApps to {"iMovie.app", "Microsoft Excel", "Microsoft Excel.app", "Adobe Acrobat 7.0 Professional.app", "Adobe After Effects CS4.app", "ColorEyes Display Pro.app", "Corel Painter X.app", "DiskTracker 2.3.2", "EPSON Scan.app", "Flash 8.app", "Product Ingest.app", "Product Tag.app", "Art Ingest.app", "TextWrangler.app", "Toast Titanium.app", "Suitcase Fusion 2.app", "Suitcase Fusion 3.app", "Fetch.app"}
    repeat with anApp in theApps
      set vers to version of (application anApp)
      -- get parent path of anApp!!!!
      if (parentFolder is equal to "Applications" or parentFolder is equal to "Utilities") then
      set parentFolder to ""
      end if
      display alert anApp & ": Version: " & vers & " " & parentFolder
    end repeat
    The only thing I'm stuck on is how to get the parent folder of anApp. Basically we use several versions of software here that are not easily identifiable by the version attribute. However their enclosing folder has all the versioning info I need (e.g.: MS Excel 04's vers would be 110113, but the enclosing folder is "Microsoft Office 2004", and some departments get Office 2008, Office 2011, etc., so I need a human-friendly way to get the right versions)
    I don't know if the "if" statement to check whether the parent is Applications or Utilities is correct as I haven't gotten that far in testing. I'm only interested in getting the parent of apps that have parent folder that is a sub-folder of Applications or Utilities.
    Basically what I am trying to do here is write a text file containing all departmental apps, homefolder sizes, relevant partition sizes, etc. and spit it out at the tech responsible for migrating a user to a new mac (display alert is just convenient for testing purposes). In the past we've had too many "missed" items in QC like wrong apps installed, or wrong versions, or data not copied over properly, etc. So this way they can run this on the old system beforehand and the new system after, line everything up and check off if it matches. This is just a snippet...
    TIA!
    Andrew

    Hi,
    Andrew Caldwell wrote:
    Is there a way to invoke these without the script opening each one?
    You must use the bundle identifier instead of the name
    Here a example :
    set theApps to {"com.microsoft.excel", "com.adobe.Acrobat.Pro", "com.barebones.textwrangler", "com.roxio.Toast", "com.fetchsoftworks.Fetch"}
    repeat with anApp in theApps
           tell application "Finder" to tell (application file id anApp)
                  set vers to version
                  set parentFolder to name of its container
           end tell
           if parentFolder is in {"Applications", "Utilities"} then set parentFolder to ""
           display alert anApp & ": Version: " & vers & " " & parentFolder
    end repeat

  • How to get the Page Number in CS3 with VB?

    Hi, Everybody
    I use the Visual Basic to read the words and their page number where the Words are at. I want to do it according to Story. Some TextFrame of the Story waw placed in other pages: How can I get the Page number according to the Word that is selected?
    For myStoryCounter = 1 to Document.Stories.Count
    Set myStory = Document.Stories.Item(myStoryCounter)
    For myWordCounter = 1 to myStory.Words.Count
    Set myWord = myStory.Words.Item(myWordCounter)
    myWordContents = myWord.Contents
    Rem ** How to Get the Page Number according to the Word ***
    Next
    Next

    > But I don't understand why Item(1) are set.
    because Word can have more than one parent TextFrame - when split across TextFrames
    only Character have one ParentTextFrame accessed also by ParentTextFrames.Item(1)
    > why Story.TextFrames.Count alway is 0, Is it bug?
    no - it's not bug
    in older IDs - Story.TextFrames collection refer to all TextFrames as containers for Story text
    but in CS3 - collection Story.TextFrames contain all TextFrames inserted as InLine/Anchored objects - same like Story.Rectangles or Story.Ovals
    in CS3 - when you want to refer to TextFrames as containers for Story text - you need to use Story.TextContainers - because now you can link TextFrame and Text-On-Path as Story - Text-On-Path isn't TextFrame
    robin
    www.adobescripts.com

  • How to get the values from html:select? tag..?

    i tried with this, but its not working...
    <html:select styleClass="text" name="querydefs" property="shortcut"
                 onchange="retrieveOptions()" styleId="firstBox" indexed="true">
    <html:options collection="advanced.choices" property="shortcut" labelProperty="label" />
    </html:select>
                        <td align="left" class="rowcolor1">
                        <script language="javascript" type="text/javascript">
                              function retrieveOptions(){
                             var sel = document.querydefs.options;
                             var selectedOption = sel[sel.selectedIndex].value;
                             document.write(selectedOption);
                           </script>

    <td align="left" class="rowcolor1">
                        <script language="javascript" type="text/javascript">
                              function retrieveOptions(){
                             var sel = document.querydefs.options;
                             var selectedOption = sel[sel.selectedIndex].value;
                             document.write(selectedOption);
                           </script>This java script is not working at all..its not printing anything in document.write();
    This is code..
    <td class="rowcolor1" width="20%">
    <html:select styleClass="text" name="querydefs" property="shortcut"
                             onchange="retrieveSecondOptions()" styleId="firstBox"
                             indexed="true">
                             <html:options collection="advanced.choices" property="shortcut"
                                  labelProperty="label"  />
                        </html:select>i tried with this also. but no use..i'm not the getting the seleced option...
    function retrieveOptions(){
    firstBox = document.getElementById('firstBox');
                             if(firstBox.selectedIndex==0){
          return;
        selectedOption = firstBox.options[firstBox.selectedIndex].value;
    }actually , how to get the values from <html:select> ...?
    my idea is to know which value is selected from the combo box(<html:select> ) if that value is equal some string i have enable a hyperlink to open a popup window

Maybe you are looking for

  • How do I upgrade my iPod for apps

    How do I upgrade my iPod for apps?

  • Switch phone numbers with a family member on a different plan

    Hello! I have a Verizon cell phone plan and my mother has a separate plan. A few years ago my mother got a phone that she absolutely hated so I agreed to take her phone and she took mine. What ended up happening is that she has a phone that I technic

  • Development Tools: Which of them i really need?

    Hi, guys! I've just started to learn Java language & gonna develop midlets for most modern wireless devices. Please tell me what tools i really need to download. I've already downloaded Wireless Toolkit (with latest patch) & JRE. I guess i need some

  • Strange icon appears on my web pages

    I have a web site and for a long time now this icon has been appearing in my editor and now it sometimes appears on my live web page this is the icon  I have disabled all my plugins and add ons have disabled F7 someone had suggested the charset Curr

  • How to calculate total value in categories?

    I know Numbers let you do subtotal in categories. However at the end of the table, i want a nice total value in a single row that is not in under any category. For example, Number's Home Inventory Template, when you want open a new file. It has Maste