I want to highlight/ change color of the text of a tree node in smartgwt. I tried TreeGrid.selectRecord(node) which works, but this creates a background for the width of the tree.
I just want to highlight the text(title of the node) or change the text color of the title of the node.
Can this be done?
You can use the following:
treeNode.setCustomStyle(stylename);
You may also take a look at this link.
Related
I have a text field and I'm able to change the text size of a Text node no problem with
Text text = new Text();
text.setStyle("-fx-font-size: 16;");
but if I try to change the colour, nothing works:
textStart.setStyle("-fx-font-size: 16;-fx-color: #ff0000;-fx-text-base-color: #ff0000;-fx-text-fill: #ff0000;");
I find in JavaFX every node seems to need a different css command to successfully change the colour, but with Text, none of them seem to work. I can change the text with
text.setFill(Color.RED);
But it's awkward to have two separate commands on separate lines when it should be able to be done in one line of css. Especially since what I'm doing is relatively heavy processing of many lines of text.
Does anyone know what the css command to change the colour is with a Text node? Seems so odd it only accepts the size command in css..
Im trying to do an OrgChart using d3 , i decided to use this tree Collapsible tree, so i want to remove the circles and apply my own style on the tree like adding borders to each title, change background color and so on...
Is there is any way i can do it ? if not do you suggest any other approach to create interactive organizational chart?
You cannot add borders and backgrounds to text, at least directly.
You can add some rectangles behind the text elements and style them as you want.
The issue with this approach is that you need to compute the text size for each element, so you size the rectangles properly.
You can make it a try and post your specific questions here.
i am trying to accomplish the following behavior with a QML TextArea:
I want single Words in the Text to be colored differently
I want the "select"-functions to be working for automated scrolling (user interaction is disabled)
There is a stream of text in the TextArea where one Word needs to be selected(highlighted). The user is requested to input some text elsewhere and press enter to proceed (not part of the question). After that the selection jumps to the next word and the last selected word is either colored green or red. There is only a small portion of the text visible (a few lines, managed by the TextArea height – not part of the question) and i need the text to scroll if the next word is out of that visible range .. therefore the selection is quite helpful because all interaction from the user – to scroll or select or whatever – is disabled (disabling is not part of the question)
my main problem is: if i use textFormat: TextEdit.RichText i can easily color the text how i like it to be (<font color=\"green\">{}</font>) but i cannot use the "select"-functions anymore because – as i would guess – the selection works on the "plaintext" and cannot correspond to the "richtext"-selection? Anyway selectWord() etc. does not work QTextCursor::setPosition: Position '-1' out of range is the result. But if i disable the RichText i don't know how to color the text. Maybe i could live without the selection if i could detect the current word – which would be colored blue etc. – and scroll if its out of the visible area to "fake" the selection behavior, but that's just a third option.
I would really either know how to color non-Rich Text or how to select Rich Text in a TextArea.
You can use QSyntaxHighlighter to highlight the words independent of the selection. See QQuickTextDocument and How to implement rich text logic on QML TextEdit with QSyntaxHighlighter class in Qt for more details.
I have a problem when trying to change the color of QTabBar's top line (blue line in the picture below).
Is this a separate part of tabBar (like scroller or tear) or its top border ? And how can I change its color with styleSheet and leave the other parts of tabBar unchanged?
P.S. : My tabBar::styleSheet returns an empty string, so I can't get current style and make changes in it.
If you're using a "system" style, you may not be able to change the color of the line (cause representation of UI elements is not handled by Qt but by the system).
You should define a complete style for QTabBar (and maybe QTabWidget too) that you can customize as you wish.
See the Qt Style Sheets Examples page.
Problem solved:
setStyleSheet("QTabBar::tab:selected { selection-background-color: red; }");
When you select text in a Text or Label or TextArea (or other) control in a Flex application, the selection is shown in white text on a black background. Always.
I have a request to change that — and it seems to be a simple enough thing to want — but I can't find a style (or property) anywhere that permits that. Any ideas out there about how to do this, or reasons why it definitively can't be done?
Change TextField selection color in AS3
http://ericlin2.tripod.com/select/selectt.html