Fixing "hint" property

This commit is contained in:
Alexei Anoshenko 2024-04-22 16:35:18 +03:00
parent befb2a7484
commit 0740a48346
1 changed files with 19 additions and 8 deletions

View File

@ -517,19 +517,30 @@ func GetHint(view View, subviewID ...string) string {
if len(subviewID) > 0 && subviewID[0] != "" {
view = ViewByID(view, subviewID[0])
}
session := view.Session()
text := ""
if view != nil {
if text, ok := stringProperty(view, Hint, view.Session()); ok {
return text
}
if value := valueFromStyle(view, Hint); value != nil {
if text, ok := value.(string); ok {
if text, ok = view.Session().resolveConstants(text); ok {
return text
var ok bool
text, ok = stringProperty(view, Hint, view.Session())
if !ok {
if value := valueFromStyle(view, Hint); value != nil {
if text, ok = value.(string); ok {
if text, ok = session.resolveConstants(text); !ok {
text = ""
}
} else {
text = ""
}
}
}
}
return ""
if text != "" && !GetNotTranslate(view) {
text, _ = session.GetString(text)
}
return text
}
// GetMaxLength returns a maximal length of EditView. If a maximal length is not limited then 0 is returned