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.
Related
i'm using LIBGDX.
i'm trying to set a text string in the center of an image, and use it as a clickable button.
unfortunately i didn't find a solution for it.
Yes you can with the getLabel method:
myButton.getLabel().setAlignment(Align.center);
https://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/utils/Align.html
By default, ImageTextButton contains 2 Actors in 1 row: Image then Label. To change position of the Label one may rebuild the underlying table cells just after creation of ImageTextButton:
new ImageTextButton(...) {
val label = getLabel
val image = getImage
clearChildren()
add(image)
row() // second row
add(label)
}
Now Label will be under the Image. Code is Scala.
I have a problem with dynamic item renderer for data grids elements.
I'm initialiizng columns in my data grid dynamically, like this:
for each (var item in _collection)
{
var i:MyClass= item as MyClass;
var dgc:DataGridColumn = new DataGridColumn(i.Id.toString());
dgc.headerText = i.Name;
cols.push(dgc);
}
_myDataGrid.columns = cols;
To every cell I want to pass integer. When it has -1 value, cell should display specific text but when it's 0 or 1 it should contain checkbox.
Do you know how can I achieve that? I don't any ideas for now, despite I was thinking about this for quite long time. Can you help me with this?
Create itemRenderer with two states. One state with checkbox another with text
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.
Design a Text Input by using components in flash and its InstanceName is listChat. In that text input I added a text by Dynamically. While I am adding text it displays with null.
For Example I added "apple" it Displays like nullapple
How to remove that null?
You can use the String's replace method.
If you want to remove only the first encounter of 'null' you can use this:
listChat.text = listChat.text.replace("null", "");
If you want to remove all encounters of 'null' this will do it:
var stripNullPattern:RegExp = /null/gi;
listChat.text = listChat.text.replace(stripNullPattern, "");
If you only want to remove null if it's in the first four characters use something like this:
if(listChat.text.substring(0, 4) == "null")
{
listChat.text = listChat.text.replace("null", "");
}
Check the AS3 reference for more info:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/String.html#replace()
I follow the http://gmaps-samples-v3.googlecode.com/svn/trunk/geocoder/getlatlng.html
instead of displaying the 'latlng' in ,
how do i display it in
If I understand your question correctly (.ie the lat/long value is appearing in the div below the map and you want it to appear in the input text field at the top) then you should change the following line of Javascript (Line 75)
document.getElementById('latlng').innerHTML = latlng;
to
document.getElementById('address').value = latlng;