Right justify text in Devexpress TextEdit and show text from the end - devexpress

I would like to right justify text and show text from the end.
For example:
say textEdit1 has filepath as its content
"C:\Users\xxx.xxx\Documents\xxx\CODE\test\inner test\another\another\filename.sdfx"
If the entire text is not visible in the text edit then show text from the end so that filename is always visible.
I know how to right justify text but not sure about the second part. Any help highly appreciated.
In the above image the filepath is too long to be shown fully so I would like to show the path from the end so that filename is always visible. Hope I made myself clear.
I am using Devexpress 11.2 for Windows.

I think the caret position in the editor can be set using the SelectionStart and SelectionLength properties. After that, all you have to do is to implement both GotFocus and LostFocus events so that even when there is no focus, the end of the text is shown.
More details here.

I found the solution which is to do with SelectionStart as stated above but it has to be done after the TextEdit is completely loaded.
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
textEdit1.Text = #"C:\Users\xxx.xxx\Documents\xxx\CODE\test\inner test\another\another\filename.xxx";
textEdit1.SelectionStart = textEdit1.Text.Length;
}
All thanks to Devexpress.

Related

Create scrolling text when text is too long

I have a dynamically built string that is sometimes too long, but still needs to be displayed fully to the user. I would much rather have the text scroll than creating a tooltip for it.
I have creating a label with this:
Label text = new Label("hello there i hope this text is long enough to take up space");
TranslateTransition tran = new TranslateTransition(Duration.millis(75000));
tran.setNode(text);
tran.setByX(-400);
tran.setInterpolator(Interpolator.LINEAR);
tran.setCycleCount(Timeline.INDEFINITE);
// add the text
tran.play();
One, when I do this, if the text is "this is really long" and it's shortened to "this is really..." then when the label scrolls, the text remains "this is really...". Another thing is this scrolls the label away, changing the x position of the element. Is there a way to just change the text will a scroll instance?
Also, is there a way to programatically determine if a given text is going to be too large for a specified area?
The most simplest method could be "marquee":
http://www.quackit.com/html/codes/html_marquee_code.cfm
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/marquee
http://www.sitepoint.com/web-foundations/marquee-html-element/
But it´s nonstandard: http://www.w3.org/TR/css3-marquee/
A better method is CSS3: http://www.hongkiat.com/blog/css3-animation-advanced-marquee/

wxWidgets: wxButton with both bitmap and text

I want my wxButton to have a black background and white text for it's label. I tried this sample code only I also tried it with wxButton and SetBitmapLabel.
All I could manage was to get the bitmap to display, however I also want the button's text (label) to be displayed over the bitmap at the same time. How could I do this?
It's not clear what do you want to use a bitmap at all if just want to display the text. What's wrong with just doing
wxButton* b = new wxButton(...); // possibly use wxBORDER_NONE style
b->SetBackgroundColour(*wxBLACK);
b->SetForegroundColour(*wxWHITE);
?
Also notice that since wxWidgets 3.0 the functionality of wxBitmapButton is available in wxButton itself, i.e. you can set a bitmap for any button and it will be displayed in addition to the text.

Fitting the label text of tab widet Qt

I have a tab widget with two tabs in it in my Qt application. When I set the label text for a tab to a long word like 'Difference', some of the text goes out of the boundary of the tab and is not shown. How do I fix this so that the entire label text fits exactly in the tab?
Thanks,
Rakesh.
Qt receives that style from OS. By default on Windows text isn't truncated. You can set it manually using
QTabWidget::setElideMode( Qt::ElideNone );
I think elideMode would be helpful for you.
Try setting the value to Qt::ElideNone which will not show the ellipsis in the text, so I am guessing it might show the entire text.

what property should i set to Fit the text in label

I want to display a big string in a Qlablel for this I simply have created a label in the Qt GUI editor.
Then set the string with the Wordwrap property to "ON".
Here text is not coming to the next line itself. Instead, it's crossing the view region.
However, if I give an "\n" it works well.
How do I put up the big string in a label to display in a visible region?
label->setWordWrap(true);
See the QLabel::setWordWrap(bool on) documentation.

A real drawText call in Flex?

I am now developing a Flex application in which I need to control each pixel of my control of Flex. I want to calculate that how width and how height of some text used in my control and do some layout stuff.After some searching I find that the only way to draw text in Flex is to use something like TextField. So, I use TextField to display text and try to get the width and height of the text through:
textfiled.getLineMetrics(0).width/.height;
But the real textfield is much more bigger than this, so I do:
textfield.width = textfiled.getLineMetrics(0).width;
textfield.height = textfiled.getLineMetrics(0).height;
But, the textfield get part not displayed, and I am surprised by this effect. I know there should be a 2-pixel gutter around the text, but what the remain space? Why nearly 20% part of the text height/width are not displayed?
And how can I get a real drawText call in Flex, I mean something like Windows's drawText method...
Thanks!
you can try this : getCharBoundaries () i've used it and seems accurate hoever it is for char and not a whole text so you will need to iterate through the text
also see this :
Is there a way to get the actual bounding box of a glyph in ActionScript?
Please try:
textfield.width = textfield.textWidth + 4;
textfield.height = textfield.textHeight + 4;
I'm not familiar with Windows's drawText method so I cannot help you there, but perhaps you want to have a look at the stellar text layout functionality in Flex 4.

Resources