Set position of LabelCell inside SelectBox in Scene2D - LIBGDX - libgdx

I have a SelectBox; how do I position the selected item text (label cell) ? For example in a TextButton I used getLabelCell().padLeft ... whenever I wanted to reposition the text; what can I use for the SelectBox actor because there is no getLabelCell?

select_box.background.setLeftWidth(DX_VALUE);
modifies the left padding of the text . This works well for me because all text add to the list have approximately the same character length therefore the same width.

Related

Angular 4 bind to contenteditable div innerHTML as user types

I'm trying to create a custom simple text editor so I can color certain pieces of text as the user types. So for some pieces I may want to make green, others blue. To do this I need to bind my content to the innerHTML property of the div which is working fine to initially display my content. (I can see my html rendering in the div).
<div class="textarea-editor" contenteditable="true" [innerHTML]="getBuiltRules" (input)="onRuleEditorFullKeyUp($event.target.innerHTML)"></div>
Then in the input event, I'm grabbing the current innerHTML and want to search and surround certain strings with <span class='color-green'></span> so this text would show green, then I want to have the changes rendered back to the div.
onRuleEditorFullKeyUp(value: string) {
// search and surround some text with html tags then set a variable
this.setBuiltRules = value;
}
The issue i'm having is once I set setBuiltRules = value, it seems to re-bind the innerHTML and the carat position goes to the very beginning. So if i'm typing something, it goes to the beginning after each character.
Is there a better way to do this so I don't lose my cursor position?
Note: setBuiltRules and getBuiltRules reference a service property.

autosizing movieclips to match text size (AS3)

I'm looking to add a specialized border around some dynamic text.
A special type of border that filters just can not produce
So I need this border to match the length of the dynamic text.
Unfortunately this code is not working
thistext.autoSize = TextFieldAutoSize.LEFT;
border.width = thistext.width;
What happens is, the border width is set to the initial starting width of the text and is not changed as the width of the text changes
Any ideas on how I can make this work?
You should rather listen only to text changes : flash.events.Event.CHANGE, instead of checking every frame.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/TextField.html#event:change
Besides, you may use textWidth attribute to get actual text width, no matter the value of autosize attribute (Width must be set to the maximum width). I'm not a huge fan of auto size feature which hides the maximum width, although it exists internally ( equal to the width attribute of the textfield, BEFORE setting autosize..). I'd rather have a less "magical" but more clear behavior, but it's debatable, especially if your text has to interact with the mouse (click,hover..), then you can take advantage of the bounds being automatically updated
I actually caught my mistake.
I need to add the code into an event listener that checks every frame AFTER the dynamic change so this code works
border.width = thistext.width;

Styling Birt reports

I have some problem with text and image alignment(they should be on the same height).I tried to apply some css styles like "vertical-align: middle;" but it doesn't seem to work in pdf specified output format. Inside Grid item I use text item and got the output:
The part of text item (one checkbox):
<div style="background-color:GRAY"><span>
Permanent </span><IMG src="<VALUE-OF>occur[0]</VALUE-OF>" height="0.3cm" width="0.3cm"><span> </span></div>
The second issue (different component of the report) is to get rid of white space shown in the picture below in yellow:
The report layout consists of grid item and label items inside.I set height property of Grid and Row to empty value.
Use the "outline" view to select your Grid-Cell. If you click on it in Desing-View you will probably only click on the label inside your Grid-Cell.
Select the "Padding" Register in the Property Editor and change all values to 0 (default is 1). Repeat this step also for your Labels. This should remove the white space.
Perhaps you can use the Padding to shift your Images and Text onto the same line if you add them in different components and not in a single div.

How can I align label of a button component

I have a button component on my scene. But when I set labelPlacement to left, it can't do that. How can I fix this?
From what I understand and have read about the labelPlacement property is that it works in conjunction with the use of an icon within the button, not to necessarily change the position of the text in relation to the button boundary.
Here is some text that documents this from the Adobe Website:
If you are using an icon with a Button instance, you can control the placement of the text label, relative to the icon, by setting the labelPlacement property using one of the constants from the ButtonLabelPlacement class (fl.controls.ButtonLabelPlacement). For more information on working with button icons, see Setting icons.
Source: http://www.adobe.com/devnet/flash/quickstart/button_component_as3.html
Additional sources: http://www.adobe.com/devnet/flash/quickstart/button_component_as3.html#articlecontentAdobe_numberedheader_6
However, a hackish way of moving the text to the left would be to add spaces to the right of the string. Currently, empty spaces at the start or end of the label are not auto trimmed. Here is an example of what I am talking about:
import fl.controls.Button;
var myButton:Button = new Button();
myButton.label = "Click me ";
addChild(myButton);
I tested the code shown above in Flash CC 2014 and the text looked like it was left aligned, when it really wasn't because of the additional spaces added to the end of label.
It is worth mentioning that I also experiemented with the textField property of the Button class to see if the autoSize or setTextFormat functionality could be used to left align the text, and those all failed.

How to Change Text Cursor Color of Text Input Flex 4?

I want to change the blinking text cursor color of Text Input in Flex 4...
How can I change it ?
Is there any way to handle it, or it can be only controlled by Flash Player ???
I had a similar question about this a while ago. I never found a way to update the actual cursor, so I got creative with the solution. My solution was to have two textfields stacked. One input field on top of a dynamic field.
Set the alpha of the input field to 0. Then, add a CHANGE event listener to the input field. In the handler, update the dynamic field and reposition your cursor based on the textWidth.
Not ideal, but it did the job.
I had solved this problem,
Actually there was a problem in skinning of text input.
If we set textinput skin's richeditabletext's alpha to 75 or some down value, flash player makes cursor color white itself.
So by increasing that alpha value, I got the cursor color black.
I change the TextField.textColor = OxFFFFFF, the cursor changes into white as well. Works for my case when I need the same color for the blinking cursor and text.