Skip navigation
Currently Being Moderated

How to change the textEdit border programmatically

Mar 10, 2005 11:48 AM

How do I programatically change all four edges in a border? I only seem to be able to get to the top edge. Assume that the following code is in the click event of a text edit box.

// Sample code - changes top edge only
var textEdit = this.ui.nodes.item(0);
textEdit.border.edge.color.value = "101,152,42";

Below is the XML from the XDP file - I tried enumerating the various nodes but it doesn't seem like the in-memory form object model is exactly the same as the XDP object model.


 
    
       
          
       

       
          
       

       
          
       

       
          
       

       
          
       

     

     
 

 
Replies
  • Currently Being Moderated
    Mar 10, 2005 3:01 PM   in reply to (Mordechai_Beizer)
    The object model is pretty much spot on with respect to the XML. The only trouble is in accessing the nodes correctly. There is a method which handles this type of multiple instances with respect to properties and it is getElement(nodeName, instance)

    To access properties like the edge colour use the following:

    TextField1.ui.oneOfChild.border.getElement("edge", 0).color.value = "192,0,0";
    TextField1.ui.oneOfChild.border.getElement("edge", 1).color.value = "0,192,0";
    TextField1.ui.oneOfChild.border.getElement("edge", 2).color.value = "0,0,192";
    TextField1.ui.oneOfChild.border.getElement("edge", 3).color.value = "192,192,192";

    It should display a multi-colour border. I set the field to have a solid edge.
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 11, 2005 6:15 AM   in reply to (Mordechai_Beizer)
    Yes, IMO it is the inner border which is inconsistant. I think you should be able to just use edge and mean all fours edges like the outer border does.

    The oneOfChild is used where you have a mutually exclusive group of objects which can act as a child of the current object. For example ui can only have 1 child, but it can be from a list of different objects (i.e. button, textEdit, chooseList, etc.). When you do not know what type of child ui object you wish to modify or don't care use the oneOfChild method.
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)