Cabbage Logo
Back to Cabbage Site

Text Editor random behavior

Hey Rory,
I came across some weird behavior of the text editor. I put my whole cabbage code in a plant to be able to move all widgets as one.
Since then, the text editor widget goes into edit mode whenever I touch any widget.
Here is an example:

<Cabbage>
form caption("Untitled") size(400, 300), guiMode("queue") pluginId("def1")
image bounds (10,10,380,280) colour("darkblue")
{
rslider bounds(50, 50, 100, 100), channel("gain"), range(0, 1, 0, 1, .01), text("Gain"), trackerColour("lime"), outlineColour(0, 0, 0, 50), textColour("white")
texteditor bounds(0, 0, 300, 20), align("right"), , fontColour(255, 255, 255, 255), colour(255,255,255,0), channel("text") text("text edit")caretColour("white")
}
</Cabbage>

Also, do you think you could change the texteditor widget, so that it goes out of edit mode after you press enter?
Thanks!

It is always in edit mode. If you don’t want it to be in edit mode you need to set readOnly(1). I’m wondering if the text editor is really the best fit for what you want?

If I did that then users would have to click it every time they want to work with it. So if they are live coding and sending messages to Csound they would have to reach for their mouse after every event. This would certainly break some existing user flow and make live coding an extremely painful exercise…

What I meant is, usually I have to click onto the texteditor in order to actively change the text / have a blinking cursor in it. When the texteditor is inside a plant, it starts to edit the text once you click somewhere inside the whole plant.

To get out of editing the text on enter, would it be possible to set it to readOnly(1) on k-rate after it parsed a change? I’d have to manually set it to readOnly(0) when I click it again if that works. I’m just using it to rename sample names, so if it keeps editing the text on keystrokes after hitting enter until I clicked another widget it’s a bit weird, so I hope I can solve it like that.
Otherwise I might just take the whole feature out.

Found a way, to get out of edit mode when hitting return by making the texteditor invisible and visible again with a short delay after it parses a change.
One other question: Is there a way to change the font size of the texteditor?

I just pushed support for fontSize() for the text editor widget.

1 Like