Skip to content

Commit a0d96c6

Browse files
committed
Fix no_write cursor not showing for multi-line TextEntry widget
Fixes issue ControlSystemStudio#3502 where no_write cursor only showed around the border of disabled TextEntry widgets with multi-line entry enabled.
1 parent 14cf185 commit a0d96c6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/TextEntryRepresentation.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import static org.csstudio.display.builder.representation.ToolkitRepresentation.logger;
1111

12+
import java.util.UUID;
1213
import java.util.concurrent.TimeUnit;
1314
import java.util.logging.Level;
1415

@@ -51,6 +52,8 @@ public class TextEntryRepresentation extends RegionBaseRepresentation<TextInputC
5152
*/
5253
private boolean active = false;
5354
private volatile boolean enabled = true;
55+
private static final String NODE_ID = UUID.randomUUID().toString();;
56+
5457

5558
private final DirtyFlag dirty_size = new DirtyFlag();
5659
private final DirtyFlag dirty_style = new DirtyFlag();
@@ -101,6 +104,7 @@ public TextInputControl createJFXNode() throws Exception
101104
text = new TextField();
102105
text.setMinSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
103106
text.getStyleClass().add("text_entry");
107+
text.setId(NODE_ID);
104108

105109
if (! toolkit.isEditMode())
106110
{
@@ -425,6 +429,12 @@ else if(jfx_node instanceof TextArea){
425429
String alignment = model_widget.propHorizontalAlignment().getValue().toString().toLowerCase();
426430
PseudoClass alignmentClass = PseudoClass.getPseudoClass(alignment);
427431
jfx_node.pseudoClassStateChanged(alignmentClass, true);
432+
433+
if (jfx_node.getScene() != null) {
434+
// Need to get the TextArea 'content' node to set the cursor
435+
// for the whole widget otherwise it will only show on the borders.
436+
jfx_node.getScene().lookup("#"+NODE_ID+" .content").setCursor(Cursors.NO_WRITE);
437+
}
428438
}
429439
}
430440
if (! active)

0 commit comments

Comments
 (0)