I have a cell and want to display 'hello' in the middle and if some condition is true then display 'world' at the right bottom of that cell.
Here, Only hello and world is getting displayed but 'world' not at the right bottom.
tc.InnerHtml = "Hello";
if(some condition)
{
Label lblBundle = new Label();
lblBundle.Style.Add("font-size", "5px");
lblBundle.Style.Add("float", "right");
lblBundle.Style.Add("float", "bottom");
lblBundle.Text = "world";
tc.Controls.Add(lblBundle);
}
Can anyone please help me out. I am displaying the label control dynamically.
if you want to append just word to existing content than why you need to add label. try following:
tc.InnerHtml = tc.InnerHtml + " world"
Related
I am trying to make a web to change the data base. The problem is that some attributes from the DB are in html format, and when I try to set the input's value to the current DB attribute, it crashes.
The code that I use is the following:
$('#projectlist').DataTable( {
"createdRow": function ( row, data, index ) {
var ele = $('td', row).eq(1);
var id_input = $('td', row).eq(0);
id_input = id_input[0].innerHTML;
ele[0].innerHTML = '<input id="'+id_input+'" value="'+ele[0].innerHTML+'" style="width:100%; height: 25px;">';
},
data: data
} );
This just sets the second element from the table to be an input with the value equal to the DB.
But when the DB has html code like this one
text \" moretext
the input finishes at the \ and following text is shown as regular text instead of input.
here's an image of the problem. As you can see the top input is how it should be showing and the bottom input has the text that doesn't stay inside in the input box, it justs contiunes like text.
like k-nut said, doing it with jquery solves the problem. If someone is interested, changing the code to this solved the problem:
var ele = $('td', row).eq(1);
var id_input = $('td', row).eq(0);
var content=ele[0].innerHTML;
id_input = id_input[0].innerHTML;
ele[0].innerHTML = '<input id="'+id_input+'" style="width:100%; height: 25px;">';
$( "#"+id_input ).val(content);
I'd like to know if it's possible to fill text fields by clicking on a data grid row, or by selecting a row and clicking a button "fill text fields".
Must be in AS3/Flash.
Thanks in advance.
I did try several aproaches and find a solution:
// import fl.events.ListEvent; <----- Important
toPrint.myGrid.addEventListener(ListEvent.ITEM_CLICK, onClick);
function onClick(e:ListEvent):void
{
var over = e.item;
// Fill the dynamic text fields
name.text = over.Name;
surname.text = over.Surname;
company.text = over.Company;
year.text = over.Year;
}
WorkS like a charm.
I want to get radioButton's label height in as3.
I have 5 radio buttons in my radioButton group. One of those radioButtons has a three line label, another has a single line etc...
When I try to access the radioButton.height, I always get same value regardless of the label height.
I need to know the height of the label, so I can set the radioButton y coordinate accordingly.
can I change the radioButton's label height?
spacing = 30;
rb.label = tempQQString //from xml. long or short string anyone
rb.group = myGroup;
rb.value = i + 1;
rb.x = answerX;
rb.y = questionField.height + (questionY+20) + (i * spacing); // here use rb.height or rb.textField.height
trace("rb height**" + rb.height) // always get velue 22;
addChild(rb);
RadioButton and any fl control that extends labelButton (all the ones that have a label), expose the actual text field with the .textField property.
So for your example, instead of using rb.height, you would use rb.textField.height to get the height of just the label portion of the control.
You can also set properties on the textField as well.
rb.textField.background = true;
rb.textField.backgroundColor = 0xDDDDDD;
rb.textField.multiline = true;
rb.textField.wordWrap = true;
rb.textField.autoSize = TextFieldAutoSize.LEFT;
now, for your scenario, you may be better off just using the radio button's bounds instead, as it will be the REAL height of the object.
rb.getBounds(rb).height; //this will be the true height of the component.
If your label was one line and your icon was taller than your label, you could potentially be getting a value from rb.textField.height that is smaller than the real height of the radio button.
Try this.
for(var i=0;i<rb.numChildren;i++){
if(rb.getChildAt(i) is TextField){
var txt:TextField = rb.getChildAt(i) as TextField;
trace(txt.height+":"+rb.height);//traces the height of text field and radio button
}
}
I have created a simple text chat application for android device using flex 4 and action script 3. in the text chat I have given a option for change font color. I have used "TextInput" for enter text message and "Textarea" for shows the chat messages. when I change the color of the text, all the lines in the "textarea" color has been changing.
textoutput.setStyle("color",textInput.getStyle("color"));
textoutput.text += userNameInput.text + ": " + msg + "\n";"
this is the code I have used. but I need to change the color for every line in the "textarea".
In the other hand, i have created the panel for display chat, and dynamically created the label for the message and dynamically I have changed the color but all the lines are merging in same line. I need to add line break for every dynamic label in the panel window.
var mylabel:Label=new Label();
mylabel.setStyle("color",textInput.getStyle("color"));
mylabel.text += userNameInput.text + ": " + msg + "\n";
panelId.addElement(mylabel);"
this is the code I have used for adding dynamic label into Panel . can any one kindly suggest me some idea for solving any one of this problem means that should be very helpful for me. thanks in advance.
Here is some info that might be helpful , from http://help.adobe.com/en_US/as3/dev/WS8d7bb3e8da6fb92f-20050207122bd5f80cb-7ff5.html
Formatting ranges of text within a text field
A useful method of the flash.text.TextField class is the setTextFormat() method. Using setTextFormat(), you can assign specific properties to the contents of a part of a text field to respond to user input, such as forms that need to remind users that certain entries are required or to change the emphasis of a subsection of a passage of text within a text field as a user selects parts of the text.
The following example uses TextField.setTextFormat() on a range of characters to change the appearance of part of the content of myTextField when the user clicks the text field:
var myTextField:TextField = new TextField();
myTextField.text = "No matter where you click on this text field the TEXT IN ALL CAPS changes format.";
myTextField.autoSize = TextFieldAutoSize.LEFT;
addChild(myTextField);
addEventListener(MouseEvent.CLICK, changeText);
var myformat:TextFormat = new TextFormat();
myformat.color = 0xFF0000;
myformat.size = 18;
myformat.underline = true;
function changeText(event:MouseEvent):void
{
myTextField.setTextFormat(myformat, 49, 65);
}
I am using textInput within grid using rendrer. I am populating a suggestion box just below the text input field on the basis of typed character and index of text input.Problem is that if i shrink grid column then suggestion box is not populating at the right place so I want global position of cursor in the text input field .
Something like that:
var inputTxt : TextInput = new TextInput;
var x : Number = inputTxt.cursorManager.currentCursorXOffset;
var y : Number = inputTxt.cursorManager.currentCursorYOffset;
Try using 'global coordinate'.
This might resolve your problem.