How do I add OnClick event on part of the text? - onclick

I need to add OnClick event to part of the text in installer.
So it will be like this "bla bla bla clickable text bla bla bla".
Also this text should be with WordWrap property set to True, since I don't know exact size of it because of bunch of localizations.
I was trying to split text into 3 parts so it will be like this
"Not-clickable-text1 clickable-text2 Not-clickable-text3"
but the problem begins when text3 should go to the next line of installer. It starts from position of text3.Left property, but I need it to start on next line from text1.Left property

There is no such thing like click-able part of the text in Inno.
You really need to use 3 "texts"- either TLabel or TNewStaticText - to build the whole sentence. The middle one will have set Font property to bold, underline or blue color (depends you want the link) and Cursor set to Hand, ... and of course the OnClick event.
Both components have property AutoSize and WordWrap which you can use.
AutoSize property set to true makes your component to fit width and height to text size. Set it to True for all 3 texts.
Position texts like this:
Text1.Left := 10; // 10 is just example
Text1.Top := 10; // 10 is just example
Text2.Left := Text1.Left + Text1.Width + 3; // 3 is space
if(Text1.Height > $Constant$) then
Text3.Top := Text1.Top + Text1.Height + 3 // Create new line
else
Text3.Left := Text2.Left + Text2.Width + 3;

Related

How to set vertical text on PHPExcel

How can I set vertical align to the text on PHPExcel
I tried with
$phpExcelObject->getActiveSheet()->getStyle('B2:B5')->getAlignment()->setReadorder(
PHPExcel_Style_Alignment::READORDER_RTL
);
But it didn't work.
I actually have:
THE TEXT
But I want
T
H
E
T
E
X
T
Like the image.
It's not vertical alignment that you want to look at: vertical alignment is whether the content should be at the top/centre/bottom of a cell; nor RTL, which is Right-to-Left. You could perhaps look at text rotation, but that rotates the orientation of the text.
You'll always need to set the row height to automatic and enable wrapping.
$objPHPExcel->getActiveSheet()
->getRowDimension(12)
->setRowHeight(-1);
$objPHPExcel->getActiveSheet()
->getStyle('A1')
->getAlignment()->setWrapText(true);
so that it will expand to the actual size of your text.
Then an option would be to add a new line character after every character in your string before setting the cell value:
$value = "THE TEXT";
$objPHPExcel->getActiveSheet()
->setCellValue('A1', implode("\n", str_split($value)));
I See what your problem is,
I have solution for you , you still using getAlignment()->setWrapText(true); on your code, but you can add variable that fill is "\n" for every value you want it.
For Example :
$n= "\n";
$objPHPExcel->getActiveSheet()->setCellValue('A','T'.$n.'E'.$n.'S'.$n.'T');
$objPHPExcel->getActiveSheet()->getStyle('A')->getAlignment()->setWrapText(true);
result's as bellow:
T
E
S
T
Hope this answer can help you.

How can I programmatically get text selection in Adobe After Effects with ExtendScripts

I have object TextLayer with white text color string. Then I animate text color selection (second character changes color white -> blue).
How can I get this selection and color programmatically?
Seems like you can't reach the selection start and end values by scripting. But you can add expression controller effect and get the values from that one.
The code below asumes you have one comp in your project with an text layer called "my text layer".
Add an expression controller for color to that layer. Add the expression text.animator("Animator 1").property.fillColor to that effect.
You can do the same thing with the values from your selection.
var preExpression = true;
var currentTime = 5; // in seconds
// get the sourceText? works!
var val = app.project.item(1).layer("my text layer").property("ADBE Text Properties").property("ADBE Text Document").valueAtTime(currentTime, preExpression);
// get the Text Percent Start? Wont work!
var sel = app.project.item(1).layer("my text layer").property("ADBE Text Properties").property("ADBE Text Animators").property("ADBE Text Animator").property("ADBE Text Selectors").property("ADBE Text Selector").property("ADBE Text Percent Start").valueAtTime(currentTime, preExpression);
// add an expression controller for color and get the color from that one? works!
var col = app.project.item(1).layer("my text layer").property("ADBE Effect Parade").property("ADBE Color Control").property("ADBE Color Control-0001").valueAtTime(currentTime, false);
$.writeln(val);
$.writeln(sel);
$.writeln(col);
Take a look into the After Effects Scripting Guide. Use redefinery's rd_GimmePropPath script to get the match names of properties.

How to place underline under a paragraph in itextsharp

I am using iTextSharp in my current project. I have created a table with some underlined data but my requirement is shown in this image:
http://postimg.org/image/402ap3acf/
How can I build this type of table.
I need the below structure.
A/C Some text TAT Some text
----------------- -----------------
The doted lines are underline.
The underline is controlled via the Font object and if you only want to set part of a Paragraph to be underlined you'll want to use a Chunk.
Here's a quick helper method for generating a font with different styles. You can change the actual font to whatever font you want to use.
Private Shared Function CreateFont(size As Integer, Optional style As Integer = iTextSharp.text.Font.NORMAL) As iTextSharp.text.Font
Return New iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, size, style)
End Function
The style parameter takes integers from this list that you OR together:
iTextSharp.text.Font.NORMAL
iTextSharp.text.Font.BOLD
iTextSharp.text.Font.ITALIC
iTextSharp.text.Font.UNDERLINE
iTextSharp.text.Font.STRIKETHRU
So normal underlined text would be:
iTextSharp.text.Font.NORMAL Or iTextSharp.text.Font.UNDERLINE
You can use the above like this:
Dim P As New Paragraph()
P.Add(New Chunk("A/C ", CreateFont(12, iTextSharp.text.Font.NORMAL)))
P.Add(New Chunk("Some text", CreateFont(12, iTextSharp.text.Font.NORMAL Or iTextSharp.text.Font.UNDERLINE)))
EDIT
From iTextSharp's perspective, "underline" means "a line drawn underneath text". If there's no text there won't be an underline. A space, however, counts as text so you can just add extra spaces if you want like to continue the underline:
Dim P As New Paragraph()
P.Add(New Chunk("A/C ", CreateFont(12, iTextSharp.text.Font.NORMAL)))
P.Add(New Chunk("Some text ", CreateFont(12, iTextSharp.text.Font.NORMAL Or iTextSharp.text.Font.UNDERLINE)))

div with overflow on the left and left aligned showing the end of the text

trying to set up css doing the following:
Imagine we have two equal parallel divs with text in it:
<div class="xy">Example</div>
<div class="xy">This.is.a.example.of.a.long.Text</div>
The divs are wider than "Example" but less wide than "This.is.a.example.of.a.long.Text".
Now I want to see these texts left-aligned, so that the odd space is behind "Example" on the ride side.
But i also want to use
text-overflow:ellipsis
with the longer text in a way that I will see the end of the text.
So it should look like:
"Example "
"...ample.of.a.long.Text"
How do I do this?
I was just curious to your question and give it a try in java script as follows,
Demo
var maxChar = 20,
dots = '. . . ',
toTrim = $('.toTrim'),
toTrimLength = toTrim.text().length,
getChar = toTrimLength - maxChar;
if(toTrimLength > maxChar){
var newString = dots + toTrim.text().slice(getChar)
toTrim.text(newString);
}
I guess you still need to modify this to suite your requirement.
Also add the same string in title attr to see full text when hovering and if you want to do it even better. change text-overflow on :hover
this article will help you http://html5hub.com/ellipse-my-text/#i.6k1nyg11zqdiar

calculating Spark TextArea width

I am treating a spark TextArea as text input(by setting heightInLines="1"). The TextArea is part of an mxml component and I want to resize the component when the text is changed.
I haven't been able to use textArea.measureaText(textArea.text) to get line metrics and use it. I get this error "Parameter antiAliasType must be non-null."
Is there any way to get the width of a TextArea which it is going to consume at runtime for a particular string or a particular TextFlow?
A little ugly but works for me:
var uiText:UItextField = new UITextField();
// if you have custom text style on the TextArea then set it the same of this uitextfield
uiText.setTextFormat("bla bla bla");
uiText.text = "This is the text that I want the size for";
var textW:Number = uiText.textWidth;
var textH:Number = uiText.textHeight;
// then we need to consider also the border of the text area and the paddings
// try read the padding values and border sizes using getStyle(...)
myTextArea.width = textW+2*borderW+paddingL+paddingR;
myTextArea.height = textH+2*borderH+paddingT+paddingB;
That should be all

Resources