Comments (13)
Thanks for the thoughts. I just don't think we can make a good experience with multiple entry widgets.
Once we have a good API for handling rich text rendering it may be clearer how to manage the editing of it.
See #2074
from fyne.
In 2.1 we add the rich text APIs, but they will not be exposed through Entry until a future release, as the cursor management etc is more complex.
from fyne.
This is a really great suggestion and we will work toward it slowly.
The canvas text object will only ever support 1 set of styles per block of text (to keep the backends simple) but we can do lots of cool stuff in Go.
The widget.Label has recently added multi line so you can see how this is started - we add (with lots of tests) the layout code and the application of styles (through an API or a markup) which will then apply to label and entry.
I agree that this is something many toolkits lack, but it is very hard to get right and keep efficient. Let's make it happen :)
from fyne.
Work has also begun on the cursor handling in widget.Entry. Once that is complete we should be able to start work on how rich / marked up text be supported...
from fyne.
@andydotxyz I'm not sure 263a14d fixes this issue since it is concerned with select box and not entry/label. Should this issue be reopened?
from fyne.
Oops, that was a typo in the commit message I guess
from fyne.
Arguably #1447 is related to this. As mentioned there there isn't currently a mono-spaced editor widget but TextGrid is able to display mono-space. A basic example use case is a simple text editor for editing config files or perhaps as a base for a simple code editor. This would fit nicely into fynedesk much like notepad does in Windows or gedit in Gnome.
from fyne.
I've spent quite a lot of thought over the last few days on this because it's something I really need. I'm kind of trying to work with the existing fyne widgets to frankenstein what I need.
One idea I like is that content is represented by a giant slice(able) array of runes. Then the styling of the slice and (subslices) is determined by a separate index stack where for each entry in the stack it specifies the beginning index and ending index and the style to apply. That way, the edit content itself doesn't need to be broken up.
Another idea I had was playing with the idea of using a variant of GridWrapLayout to make this happen with unfortunately very ugly results (since gridwraplayout has fixed cell sizes). So, essentially a grid of Entry widgets that are arranged adjacently. The trick comes when you want to move the cursor transparently between the different entry boxes. :)
An enhanced wrapping HBoxLayout might work better since sub elements can be sized and even styled independently. Again problems with edit cursor movement between Edit elements.
from fyne.
I eagerly await the rich text solution you suggested.
from fyne.
Possible API that I have just been looking at:
var (
RichTextStyleInline RichTextStyle
RichTextStyleParagraph RichTextStyle
RichTextStyleHeading RichTextStyle
RichTextStyleSubHeading RichTextStyle
RichTextStyleQuote RichTextStyle
RichTextStyleURL RichTextURL
RichTextStyleEmphasis RichTextStyle
)
type RichText struct {
BaseWidget
Segments []RichTextSegment
}
type RichTextSegment interface {
TextRepresentation() string
CanvasRepresentation() fyne.CanvasObject
}
type TextSegment struct { // would implement RichTextSegment, handles rendering text
Text string
Type RichTextStyle
}
type RichTextStyle struct {
Alignment fyne.TextAlign
ColorName ThemeColorName
Inline bool
TextSize float32
TextStyle fyne.TextStyle
}
type RichTextURL struct {
RichTextStyle
URL url.URL
}
type HorizontalRuleSegment struct { // would implement RichTextSegment, just draws a line
}
from fyne.
I need the same.
Looking for a Scrolling box with selectable but read-only mono-spaced text for a Log View.
A feature with ScrollToLine(n int)
or SetCursorToLine(n int)
would be very helpful as well to guide the user to a specific line, e.g. scroll to bottom, top or a search result inside the text.
from fyne.
I've checked for many days and could not find how to set a font for a (Rich-)Text/Entry control. Can I expect for it on a future release please? Thanks.
from fyne.
I've checked for many days and could not find how to set a font for a (Rich-)Text/Entry control. Can I expect for it on a future release please? Thanks.
The font used in Entry matches the rest of the app and is set by the theme. To modify the styles of items inside an entry will indeed need a rich text editor, which this ticket tracks. You can see that it is currently assigned to "Cragganmore (est Sept 2022)" which is the plan as it stands.
from fyne.
Related Issues (20)
- Menu does not change when the front window changes
- widget.NewTreeWithStrings crashes when branch with "" is clicked HOT 6
- Discovered abnormal information while using FileDialog HOT 1
- Example code won't compile on windows HOT 1
- dialog "NewFolderOpen" freezes when scanning a large number of directories. HOT 1
- React Fyne HOT 2
- Add mobile web support
- Sometimes fyne fails to setup dark mode HOT 2
- add a X to just close dialog HOT 1
- How to solve Chinese garbled characters? HOT 1
- Select Does Not Gain Focus When Tapped
- Clicking on empty part of widget.List does not unfocus other widgets
- Calling popUp.Hide() closes all overlays, not just the popup itself. Feature or bug? HOT 1
- container.NewScroll does not support horizontal scroll for widget tree object HOT 5
- fyne does not render text from SVG files. HOT 1
- panic if app.New() is not the first method called. HOT 2
- Support Software Rendering for X11 by allowing to disable GLX HOT 13
- Issue with SetSystemTrayIcon when using jpg format
- Licence has self conflicting wording, possible typo HOT 3
- What means MinSize() of Entry? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fyne.