Given a rich text editor, I want to save the "rich" text to a database, and load it later.
So how can I get and set the rich text?
I looked at the API and there is a property called text which is only PLAIN text, not what I need. There is another property called textSnapshot which sounds like maybe thats what I need to use, but its READ-ONLY so I can't set it?
Is there a way to do this?
Thanks!
UPDATE
It turns out I am only going to save it from a RichTextEditor, and I need to set it has htmlText on a Text control,
so is there a way to get the rich text and convert it to hmtlText?
I'm not sure what you mean by rich text. The htmlText holds all the informations which the components use for rendering the HTML text, and which is also the base of the RichTextEditor rendering. You can get and set it, and that's exactly what you need to store in the DB and put the text back after retrieving it. There's no export it as rtf out of the component. It's rich in the sense that it's more than a simple textInput :)
Related
Sketchup - Is it possible to display the name of a Component dynamically in a Text tag?
I want the Text to change if I rename the Component, the way dimensions change when you change its size.
You could use an observer to detect when the name change and then update the Text object. I think DefinitionsObserver with the onComponentPropertiesChanged event should work for that.
You need to find a way to keep track of which text element to update though.
I want to show some text in my program and I tried with TextArea. However, the text shown is changeable. How can I make the text read only?
I did it like this:
#FXML
private TextArea myText;
and then added the following code to initialise():
myText.setEditable(false);
I needed read-only text fields, but setting the disabled property used styling which was not correct in context (in my scenario, the text field was an input to a search function where a value could be fixed in some cases - disabling the text field implied that it was not part of the search, rather than the value was fixed).
In the end I landed up using:
txtInput.setEditable(false);
txtInput.setMouseTransparent(true);
txtInput.setFocusTraversable(false);
This results in a normal looking text field that is non-reactive to the user.
Maybe just a text would serve the purpose.
Or if you want to show the text in a text field, then:
tf.setDisable(true)
In FXML, add editable="false" to your TextField tag.
Or uncheck the "Editable" checkbox in Scene Builder.
I would say just use a Label.
<TextField fx:id="input" disable="true"/>
You can use following statement in order to make text-area object non-editable with auto scrollbar:
textAreaObjectName.setEditable(false);
Hint: After setting the text to that respective textarea object using textAreaObjectName.setText() method.
I have class which inherits QTabWidget. Inside the generated tab I want to display some text.The text should not be editable by the user.But during the application execution there can be a case/s which will cause the text change. Which class should I use for text? Thought about QTextEdit - but it doesn`t look like best idea - since the user should not change the text.Also thought about QLabel - but it also is not good - since the application displays text not label.
QTextEdit can be set to read-only with its property readOnly. I use QTextEdit to display a long read-only text, because it can scroll. I also have read-write text, and by choosing the same widget for all long text, my user interface looks even.
http://qt-project.org/doc/qt-4.8/qtextedit.html#readOnly-prop
An other alternative is QWebView if you plan to have complexly formatted text.
http://qt-project.org/doc/qt-4.8/qwebview.html
i am new to flex,i want to disply mxml code as a text on mxml page(i dont want to evalute mxml tag it should be display as text only).something like shown in below link
http://examples.adobe.com/flex2/inproduct/sdk/explorer/explorer.html
how can i do this?
thanks
You can always compile your project with the view source option enabled, and then your project code will be visible with out any additional fiddling.
Use a TextArea control and set its text property. If this text is properly indented, if will be shown as the example you refer to.
Note that you cannot just read the MXML code at runtime since it is compiled down to ActionScript code. You'll need to copy the code into a string.
The following page shows how to load external images in AS3 DataGrid: http://www.adobe.com/devnet/flash/quickstart/datagrid_pt3/ (image and text are displayed in two columns)
But I wonder how the image and text can be loaded together within the same DataGrid. Within one column: Image followed by the text.
I cannot get it work so I'd be grateful for any help with examples. Thanks
You just have to write a custom CellRenderer that does it. If you really read and understand that page you linked, they explain how to make custom CellRenderers, and you can put whatever you want in a cell. An image with text, a button, a game of tetris, whatever.