mirror of https://github.com/anoshenko/rui.git
Changed ViewByID functions
This commit is contained in:
parent
0e0b73fdb9
commit
fa984dcf78
|
@ -35,6 +35,8 @@ NewEllipseRadialGradient, GetPushTransform, GetPushDuration, GetPushTiming, IsMo
|
||||||
GetBackground, GetMask, GetBackgroundClip,GetBackgroundOrigin, GetMaskClip, GetMaskOrigin, NewColumnSeparator,
|
GetBackground, GetMask, GetBackgroundClip,GetBackgroundOrigin, GetMaskClip, GetMaskOrigin, NewColumnSeparator,
|
||||||
NewClipShapeProperty, NewTransitionAnimation, NewAnimation, IsSummaryMarkerHidden.
|
NewClipShapeProperty, NewTransitionAnimation, NewAnimation, IsSummaryMarkerHidden.
|
||||||
|
|
||||||
|
* Changed ViewByID functions
|
||||||
|
|
||||||
* Added SetConicGradientFillStyle and SetConicGradientStrokeStyle methods to Canvas interface.
|
* Added SetConicGradientFillStyle and SetConicGradientStrokeStyle methods to Canvas interface.
|
||||||
|
|
||||||
* Changed Push, Pop, MoveToFront, and MoveToFrontByID methods of StackLayout interface.
|
* Changed Push, Pop, MoveToFront, and MoveToFrontByID methods of StackLayout interface.
|
||||||
|
|
|
@ -39,7 +39,7 @@ func (canvasView *canvasViewData) init(session Session) {
|
||||||
canvasView.normalize = normalizeCanvasViewTag
|
canvasView.normalize = normalizeCanvasViewTag
|
||||||
canvasView.set = canvasView.setFunc
|
canvasView.set = canvasView.setFunc
|
||||||
canvasView.remove = canvasView.removeFunc
|
canvasView.remove = canvasView.removeFunc
|
||||||
|
canvasView.changed = canvasView.propertyChanged
|
||||||
}
|
}
|
||||||
|
|
||||||
func normalizeCanvasViewTag(tag PropertyName) PropertyName {
|
func normalizeCanvasViewTag(tag PropertyName) PropertyName {
|
||||||
|
@ -72,13 +72,20 @@ func (canvasView *canvasViewData) setFunc(tag PropertyName, value any) []Propert
|
||||||
notCompatibleType(tag, value)
|
notCompatibleType(tag, value)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
canvasView.Redraw()
|
|
||||||
return []PropertyName{DrawFunction}
|
return []PropertyName{DrawFunction}
|
||||||
}
|
}
|
||||||
|
|
||||||
return canvasView.viewData.setFunc(tag, value)
|
return canvasView.viewData.setFunc(tag, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (canvasView *canvasViewData) propertyChanged(tag PropertyName) {
|
||||||
|
if tag == DrawFunction {
|
||||||
|
canvasView.Redraw()
|
||||||
|
} else {
|
||||||
|
canvasView.viewData.propertyChanged(tag)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (canvasView *canvasViewData) htmlTag() string {
|
func (canvasView *canvasViewData) htmlTag() string {
|
||||||
return "canvas"
|
return "canvas"
|
||||||
}
|
}
|
||||||
|
|
13
view.go
13
view.go
|
@ -731,6 +731,13 @@ func (view *viewData) propertyChanged(tag PropertyName) {
|
||||||
case DataList:
|
case DataList:
|
||||||
updateInnerHTML(view.htmlID(), view.Session())
|
updateInnerHTML(view.htmlID(), view.Session())
|
||||||
|
|
||||||
|
case Opacity:
|
||||||
|
if f, ok := floatTextProperty(view, Opacity, session, 0); ok {
|
||||||
|
session.updateCSSProperty(htmlID, string(Opacity), f)
|
||||||
|
} else {
|
||||||
|
session.updateCSSProperty(htmlID, string(Opacity), "")
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if cssTag, ok := sizeProperties[tag]; ok {
|
if cssTag, ok := sizeProperties[tag]; ok {
|
||||||
if size, ok := sizeProperty(view, tag, session); ok {
|
if size, ok := sizeProperty(view, tag, session); ok {
|
||||||
|
@ -765,12 +772,6 @@ func (view *viewData) propertyChanged(tag PropertyName) {
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if f, ok := floatTextProperty(view, Opacity, session, 0); ok {
|
|
||||||
session.updateCSSProperty(htmlID, string(Opacity), f)
|
|
||||||
} else {
|
|
||||||
session.updateCSSProperty(htmlID, string(Opacity), "")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
375
viewByID.go
375
viewByID.go
|
@ -2,34 +2,45 @@ package rui
|
||||||
|
|
||||||
import "strings"
|
import "strings"
|
||||||
|
|
||||||
// ViewByID return a View with id equal to the argument of the function or nil if there is no such View
|
// ViewByID returns the child View path to which is specified using the arguments id, ids. Example
|
||||||
func ViewByID(rootView View, id string) View {
|
//
|
||||||
|
// view := ViewByID(rootView, "id1", "id2", "id3")
|
||||||
|
// view := ViewByID(rootView, "id1/id2/id3")
|
||||||
|
//
|
||||||
|
// These two function calls are equivalent.
|
||||||
|
// If a View with this path is not found, the function will return nil
|
||||||
|
func ViewByID(rootView View, id string, ids ...string) View {
|
||||||
if rootView == nil {
|
if rootView == nil {
|
||||||
ErrorLog(`ViewByID(nil, "` + id + `"): rootView is nil`)
|
ErrorLog(`ViewByID(nil, "` + id + `"): rootView is nil`)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if rootView.ID() == id {
|
|
||||||
return rootView
|
path := []string{id}
|
||||||
|
if len(ids) > 0 {
|
||||||
|
path = append(path, ids...)
|
||||||
}
|
}
|
||||||
|
|
||||||
if container, ok := rootView.(ParentView); ok {
|
result := rootView
|
||||||
if view := viewByID(container, id); view != nil {
|
for _, id := range path {
|
||||||
return view
|
if result.ID() != id {
|
||||||
}
|
if container, ok := result.(ParentView); ok {
|
||||||
}
|
if view := viewByID(container, id); view != nil {
|
||||||
|
result = view
|
||||||
if index := strings.IndexRune(id, '/'); index > 0 {
|
} else if index := strings.IndexRune(id, '/'); index > 0 {
|
||||||
if view2 := ViewByID(rootView, id[:index]); view2 != nil {
|
if view := ViewByID(result, id[:index], id[index+1:]); view != nil {
|
||||||
if view := ViewByID(view2, id[index+1:]); view != nil {
|
result = view
|
||||||
return view
|
} else {
|
||||||
|
ErrorLog(`ViewByID(_, "` + id + `"): View not found`)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ErrorLog(`ViewByID(_, "` + id + `"): View not found`)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
return result
|
||||||
ErrorLog(`ViewByID(_, "` + id + `"): View not found`)
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func viewByID(rootView ParentView, id string) View {
|
func viewByID(rootView ParentView, id string) View {
|
||||||
|
@ -49,10 +60,15 @@ func viewByID(rootView ParentView, id string) View {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ViewsContainerByID return a ViewsContainer with id equal to the argument of the function or
|
// ViewsContainerByID return the ViewsContainer path to which is specified using the arguments id, ids. Example
|
||||||
// nil if there is no such View or View is not ViewsContainer
|
//
|
||||||
func ViewsContainerByID(rootView View, id string) ViewsContainer {
|
// view := ViewsContainerByID(rootView, "id1", "id2", "id3")
|
||||||
if view := ViewByID(rootView, id); view != nil {
|
// view := ViewsContainerByID(rootView, "id1/id2/id3")
|
||||||
|
//
|
||||||
|
// These two function calls are equivalent.
|
||||||
|
// If a View with this path is not found or View is not ViewsContainer, the function will return nil
|
||||||
|
func ViewsContainerByID(rootView View, id string, ids ...string) ViewsContainer {
|
||||||
|
if view := ViewByID(rootView, id, ids...); view != nil {
|
||||||
if list, ok := view.(ViewsContainer); ok {
|
if list, ok := view.(ViewsContainer); ok {
|
||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
|
@ -61,10 +77,15 @@ func ViewsContainerByID(rootView View, id string) ViewsContainer {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListLayoutByID return a ListLayout with id equal to the argument of the function or
|
// ListLayoutByID return the ListLayout path to which is specified using the arguments id, ids. Example
|
||||||
// nil if there is no such View or View is not ListLayout
|
//
|
||||||
func ListLayoutByID(rootView View, id string) ListLayout {
|
// view := ListLayoutByID(rootView, "id1", "id2", "id3")
|
||||||
if view := ViewByID(rootView, id); view != nil {
|
// view := ListLayoutByID(rootView, "id1/id2/id3")
|
||||||
|
//
|
||||||
|
// These two function calls are equivalent.
|
||||||
|
// If a View with this path is not found or View is not ListLayout, the function will return nil
|
||||||
|
func ListLayoutByID(rootView View, id string, ids ...string) ListLayout {
|
||||||
|
if view := ViewByID(rootView, id, ids...); view != nil {
|
||||||
if list, ok := view.(ListLayout); ok {
|
if list, ok := view.(ListLayout); ok {
|
||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
|
@ -73,10 +94,15 @@ func ListLayoutByID(rootView View, id string) ListLayout {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// StackLayoutByID return a StackLayout with id equal to the argument of the function or
|
// StackLayoutByID return the StackLayout path to which is specified using the arguments id, ids. Example
|
||||||
// nil if there is no such View or View is not StackLayout
|
//
|
||||||
func StackLayoutByID(rootView View, id string) StackLayout {
|
// view := StackLayoutByID(rootView, "id1", "id2", "id3")
|
||||||
if view := ViewByID(rootView, id); view != nil {
|
// view := StackLayoutByID(rootView, "id1/id2/id3")
|
||||||
|
//
|
||||||
|
// These two function calls are equivalent.
|
||||||
|
// If a View with this path is not found or View is not StackLayout, the function will return nil
|
||||||
|
func StackLayoutByID(rootView View, id string, ids ...string) StackLayout {
|
||||||
|
if view := ViewByID(rootView, id, ids...); view != nil {
|
||||||
if list, ok := view.(StackLayout); ok {
|
if list, ok := view.(StackLayout); ok {
|
||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
|
@ -85,10 +111,15 @@ func StackLayoutByID(rootView View, id string) StackLayout {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GridLayoutByID return a GridLayout with id equal to the argument of the function or
|
// GridLayoutByID return the GridLayout path to which is specified using the arguments id, ids. Example
|
||||||
// nil if there is no such View or View is not GridLayout
|
//
|
||||||
func GridLayoutByID(rootView View, id string) GridLayout {
|
// view := GridLayoutByID(rootView, "id1", "id2", "id3")
|
||||||
if view := ViewByID(rootView, id); view != nil {
|
// view := GridLayoutByID(rootView, "id1/id2/id3")
|
||||||
|
//
|
||||||
|
// These two function calls are equivalent.
|
||||||
|
// If a View with this path is not found or View is not GridLayout, the function will return nil
|
||||||
|
func GridLayoutByID(rootView View, id string, ids ...string) GridLayout {
|
||||||
|
if view := ViewByID(rootView, id, ids...); view != nil {
|
||||||
if list, ok := view.(GridLayout); ok {
|
if list, ok := view.(GridLayout); ok {
|
||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
|
@ -97,10 +128,15 @@ func GridLayoutByID(rootView View, id string) GridLayout {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ColumnLayoutByID return a ColumnLayout with id equal to the argument of the function or
|
// ColumnLayoutByID return the ColumnLayout path to which is specified using the arguments id, ids. Example
|
||||||
// nil if there is no such View or View is not ColumnLayout
|
//
|
||||||
func ColumnLayoutByID(rootView View, id string) ColumnLayout {
|
// view := ColumnLayoutByID(rootView, "id1", "id2", "id3")
|
||||||
if view := ViewByID(rootView, id); view != nil {
|
// view := ColumnLayoutByID(rootView, "id1/id2/id3")
|
||||||
|
//
|
||||||
|
// These two function calls are equivalent.
|
||||||
|
// If a View with this path is not found or View is not ColumnLayout, the function will return nil
|
||||||
|
func ColumnLayoutByID(rootView View, id string, ids ...string) ColumnLayout {
|
||||||
|
if view := ViewByID(rootView, id, ids...); view != nil {
|
||||||
if list, ok := view.(ColumnLayout); ok {
|
if list, ok := view.(ColumnLayout); ok {
|
||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
|
@ -109,10 +145,15 @@ func ColumnLayoutByID(rootView View, id string) ColumnLayout {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DetailsViewByID return a ColumnLayout with id equal to the argument of the function or
|
// DetailsViewByID return the ColumnLayout path to which is specified using the arguments id, ids. Example
|
||||||
// nil if there is no such View or View is not DetailsView
|
//
|
||||||
func DetailsViewByID(rootView View, id string) DetailsView {
|
// view := DetailsViewByID(rootView, "id1", "id2", "id3")
|
||||||
if view := ViewByID(rootView, id); view != nil {
|
// view := DetailsViewByID(rootView, "id1/id2/id3")
|
||||||
|
//
|
||||||
|
// These two function calls are equivalent.
|
||||||
|
// If a View with this path is not found or View is not DetailsView, the function will return nil
|
||||||
|
func DetailsViewByID(rootView View, id string, ids ...string) DetailsView {
|
||||||
|
if view := ViewByID(rootView, id, ids...); view != nil {
|
||||||
if details, ok := view.(DetailsView); ok {
|
if details, ok := view.(DetailsView); ok {
|
||||||
return details
|
return details
|
||||||
}
|
}
|
||||||
|
@ -121,10 +162,15 @@ func DetailsViewByID(rootView View, id string) DetailsView {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DropDownListByID return a DropDownListView with id equal to the argument of the function or
|
// DropDownListByID return the DropDownListView path to which is specified using the arguments id, ids. Example
|
||||||
// nil if there is no such View or View is not DropDownListView
|
//
|
||||||
func DropDownListByID(rootView View, id string) DropDownList {
|
// view := DropDownListByID(rootView, "id1", "id2", "id3")
|
||||||
if view := ViewByID(rootView, id); view != nil {
|
// view := DropDownListByID(rootView, "id1/id2/id3")
|
||||||
|
//
|
||||||
|
// These two function calls are equivalent.
|
||||||
|
// If a View with this path is not found or View is not DropDownList, the function will return nil
|
||||||
|
func DropDownListByID(rootView View, id string, ids ...string) DropDownList {
|
||||||
|
if view := ViewByID(rootView, id, ids...); view != nil {
|
||||||
if list, ok := view.(DropDownList); ok {
|
if list, ok := view.(DropDownList); ok {
|
||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
|
@ -133,10 +179,15 @@ func DropDownListByID(rootView View, id string) DropDownList {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// TabsLayoutByID return a TabsLayout with id equal to the argument of the function or
|
// TabsLayoutByID return the TabsLayout path to which is specified using the arguments id, ids. Example
|
||||||
// nil if there is no such View or View is not TabsLayout
|
//
|
||||||
func TabsLayoutByID(rootView View, id string) TabsLayout {
|
// view := TabsLayoutByID(rootView, "id1", "id2", "id3")
|
||||||
if view := ViewByID(rootView, id); view != nil {
|
// view := TabsLayoutByID(rootView, "id1/id2/id3")
|
||||||
|
//
|
||||||
|
// These two function calls are equivalent.
|
||||||
|
// If a View with this path is not found or View is not TabsLayout, the function will return nil
|
||||||
|
func TabsLayoutByID(rootView View, id string, ids ...string) TabsLayout {
|
||||||
|
if view := ViewByID(rootView, id, ids...); view != nil {
|
||||||
if list, ok := view.(TabsLayout); ok {
|
if list, ok := view.(TabsLayout); ok {
|
||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
|
@ -145,10 +196,15 @@ func TabsLayoutByID(rootView View, id string) TabsLayout {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListViewByID return a ListView with id equal to the argument of the function or
|
// ListViewByID return the ListView path to which is specified using the arguments id, ids. Example
|
||||||
// nil if there is no such View or View is not ListView
|
//
|
||||||
func ListViewByID(rootView View, id string) ListView {
|
// view := ListViewByID(rootView, "id1", "id2", "id3")
|
||||||
if view := ViewByID(rootView, id); view != nil {
|
// view := ListViewByID(rootView, "id1/id2/id3")
|
||||||
|
//
|
||||||
|
// These two function calls are equivalent.
|
||||||
|
// If a View with this path is not found or View is not ListView, the function will return nil
|
||||||
|
func ListViewByID(rootView View, id string, ids ...string) ListView {
|
||||||
|
if view := ViewByID(rootView, id, ids...); view != nil {
|
||||||
if list, ok := view.(ListView); ok {
|
if list, ok := view.(ListView); ok {
|
||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
|
@ -157,10 +213,15 @@ func ListViewByID(rootView View, id string) ListView {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// TextViewByID return a TextView with id equal to the argument of the function or
|
// TextViewByID return the TextView path to which is specified using the arguments id, ids. Example
|
||||||
// nil if there is no such View or View is not TextView
|
//
|
||||||
func TextViewByID(rootView View, id string) TextView {
|
// view := TextViewByID(rootView, "id1", "id2", "id3")
|
||||||
if view := ViewByID(rootView, id); view != nil {
|
// view := TextViewByID(rootView, "id1/id2/id3")
|
||||||
|
//
|
||||||
|
// These two function calls are equivalent.
|
||||||
|
// If a View with this path is not found or View is not TextView, the function will return nil
|
||||||
|
func TextViewByID(rootView View, id string, ids ...string) TextView {
|
||||||
|
if view := ViewByID(rootView, id, ids...); view != nil {
|
||||||
if text, ok := view.(TextView); ok {
|
if text, ok := view.(TextView); ok {
|
||||||
return text
|
return text
|
||||||
}
|
}
|
||||||
|
@ -169,10 +230,15 @@ func TextViewByID(rootView View, id string) TextView {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ButtonByID return a Button with id equal to the argument of the function or
|
// ButtonByID return the Button path to which is specified using the arguments id, ids. Example
|
||||||
// nil if there is no such View or View is not Button
|
//
|
||||||
func ButtonByID(rootView View, id string) Button {
|
// view := ButtonByID(rootView, "id1", "id2", "id3")
|
||||||
if view := ViewByID(rootView, id); view != nil {
|
// view := ButtonByID(rootView, "id1/id2/id3")
|
||||||
|
//
|
||||||
|
// These two function calls are equivalent.
|
||||||
|
// If a View with this path is not found or View is not Button, the function will return nil
|
||||||
|
func ButtonByID(rootView View, id string, ids ...string) Button {
|
||||||
|
if view := ViewByID(rootView, id, ids...); view != nil {
|
||||||
if button, ok := view.(Button); ok {
|
if button, ok := view.(Button); ok {
|
||||||
return button
|
return button
|
||||||
}
|
}
|
||||||
|
@ -181,10 +247,15 @@ func ButtonByID(rootView View, id string) Button {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// CheckboxByID return a Checkbox with id equal to the argument of the function or
|
// CheckboxByID return the Checkbox path to which is specified using the arguments id, ids. Example
|
||||||
// nil if there is no such View or View is not Checkbox
|
//
|
||||||
func CheckboxByID(rootView View, id string) Checkbox {
|
// view := CheckboxByID(rootView, "id1", "id2", "id3")
|
||||||
if view := ViewByID(rootView, id); view != nil {
|
// view := CheckboxByID(rootView, "id1/id2/id3")
|
||||||
|
//
|
||||||
|
// These two function calls are equivalent.
|
||||||
|
// If a View with this path is not found or View is not Checkbox, the function will return nil
|
||||||
|
func CheckboxByID(rootView View, id string, ids ...string) Checkbox {
|
||||||
|
if view := ViewByID(rootView, id, ids...); view != nil {
|
||||||
if checkbox, ok := view.(Checkbox); ok {
|
if checkbox, ok := view.(Checkbox); ok {
|
||||||
return checkbox
|
return checkbox
|
||||||
}
|
}
|
||||||
|
@ -193,10 +264,15 @@ func CheckboxByID(rootView View, id string) Checkbox {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// EditViewByID return a EditView with id equal to the argument of the function or
|
// EditViewByID return the EditView path to which is specified using the arguments id, ids. Example
|
||||||
// nil if there is no such View or View is not EditView
|
//
|
||||||
func EditViewByID(rootView View, id string) EditView {
|
// view := EditViewByID(rootView, "id1", "id2", "id3")
|
||||||
if view := ViewByID(rootView, id); view != nil {
|
// view := EditViewByID(rootView, "id1/id2/id3")
|
||||||
|
//
|
||||||
|
// These two function calls are equivalent.
|
||||||
|
// If a View with this path is not found or View is not EditView, the function will return nil
|
||||||
|
func EditViewByID(rootView View, id string, ids ...string) EditView {
|
||||||
|
if view := ViewByID(rootView, id, ids...); view != nil {
|
||||||
if buttons, ok := view.(EditView); ok {
|
if buttons, ok := view.(EditView); ok {
|
||||||
return buttons
|
return buttons
|
||||||
}
|
}
|
||||||
|
@ -205,10 +281,15 @@ func EditViewByID(rootView View, id string) EditView {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProgressBarByID return a ProgressBar with id equal to the argument of the function or
|
// ProgressBarByID return the ProgressBar path to which is specified using the arguments id, ids. Example
|
||||||
// nil if there is no such View or View is not ProgressBar
|
//
|
||||||
func ProgressBarByID(rootView View, id string) ProgressBar {
|
// view := ProgressBarByID(rootView, "id1", "id2", "id3")
|
||||||
if view := ViewByID(rootView, id); view != nil {
|
// view := ProgressBarByID(rootView, "id1/id2/id3")
|
||||||
|
//
|
||||||
|
// These two function calls are equivalent.
|
||||||
|
// If a View with this path is not found or View is not ProgressBar, the function will return nil
|
||||||
|
func ProgressBarByID(rootView View, id string, ids ...string) ProgressBar {
|
||||||
|
if view := ViewByID(rootView, id, ids...); view != nil {
|
||||||
if buttons, ok := view.(ProgressBar); ok {
|
if buttons, ok := view.(ProgressBar); ok {
|
||||||
return buttons
|
return buttons
|
||||||
}
|
}
|
||||||
|
@ -217,10 +298,15 @@ func ProgressBarByID(rootView View, id string) ProgressBar {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ColorPickerByID return a ColorPicker with id equal to the argument of the function or
|
// ColorPickerByID return the ColorPicker path to which is specified using the arguments id, ids. Example
|
||||||
// nil if there is no such View or View is not ColorPicker
|
//
|
||||||
func ColorPickerByID(rootView View, id string) ColorPicker {
|
// view := ColorPickerByID(rootView, "id1", "id2", "id3")
|
||||||
if view := ViewByID(rootView, id); view != nil {
|
// view := ColorPickerByID(rootView, "id1/id2/id3")
|
||||||
|
//
|
||||||
|
// These two function calls are equivalent.
|
||||||
|
// If a View with this path is not found or View is not ColorPicker, the function will return nil
|
||||||
|
func ColorPickerByID(rootView View, id string, ids ...string) ColorPicker {
|
||||||
|
if view := ViewByID(rootView, id, ids...); view != nil {
|
||||||
if input, ok := view.(ColorPicker); ok {
|
if input, ok := view.(ColorPicker); ok {
|
||||||
return input
|
return input
|
||||||
}
|
}
|
||||||
|
@ -229,10 +315,15 @@ func ColorPickerByID(rootView View, id string) ColorPicker {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NumberPickerByID return a NumberPicker with id equal to the argument of the function or
|
// NumberPickerByID return the NumberPicker path to which is specified using the arguments id, ids. Example
|
||||||
// nil if there is no such View or View is not NumberPicker
|
//
|
||||||
func NumberPickerByID(rootView View, id string) NumberPicker {
|
// view := NumberPickerByID(rootView, "id1", "id2", "id3")
|
||||||
if view := ViewByID(rootView, id); view != nil {
|
// view := NumberPickerByID(rootView, "id1/id2/id3")
|
||||||
|
//
|
||||||
|
// These two function calls are equivalent.
|
||||||
|
// If a View with this path is not found or View is not NumberPicker, the function will return nil
|
||||||
|
func NumberPickerByID(rootView View, id string, ids ...string) NumberPicker {
|
||||||
|
if view := ViewByID(rootView, id, ids...); view != nil {
|
||||||
if input, ok := view.(NumberPicker); ok {
|
if input, ok := view.(NumberPicker); ok {
|
||||||
return input
|
return input
|
||||||
}
|
}
|
||||||
|
@ -241,10 +332,15 @@ func NumberPickerByID(rootView View, id string) NumberPicker {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// TimePickerByID return a TimePicker with id equal to the argument of the function or
|
// TimePickerByID return the TimePicker path to which is specified using the arguments id, ids. Example
|
||||||
// nil if there is no such View or View is not TimePicker
|
//
|
||||||
func TimePickerByID(rootView View, id string) TimePicker {
|
// view := TimePickerByID(rootView, "id1", "id2", "id3")
|
||||||
if view := ViewByID(rootView, id); view != nil {
|
// view := TimePickerByID(rootView, "id1/id2/id3")
|
||||||
|
//
|
||||||
|
// These two function calls are equivalent.
|
||||||
|
// If a View with this path is not found or View is not TimePicker, the function will return nil
|
||||||
|
func TimePickerByID(rootView View, id string, ids ...string) TimePicker {
|
||||||
|
if view := ViewByID(rootView, id, ids...); view != nil {
|
||||||
if input, ok := view.(TimePicker); ok {
|
if input, ok := view.(TimePicker); ok {
|
||||||
return input
|
return input
|
||||||
}
|
}
|
||||||
|
@ -253,10 +349,15 @@ func TimePickerByID(rootView View, id string) TimePicker {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DatePickerByID return a DatePicker with id equal to the argument of the function or
|
// DatePickerByID return the DatePicker path to which is specified using the arguments id, ids. Example
|
||||||
// nil if there is no such View or View is not DatePicker
|
//
|
||||||
func DatePickerByID(rootView View, id string) DatePicker {
|
// view := DatePickerByID(rootView, "id1", "id2", "id3")
|
||||||
if view := ViewByID(rootView, id); view != nil {
|
// view := DatePickerByID(rootView, "id1/id2/id3")
|
||||||
|
//
|
||||||
|
// These two function calls are equivalent.
|
||||||
|
// If a View with this path is not found or View is not DatePicker, the function will return nil
|
||||||
|
func DatePickerByID(rootView View, id string, ids ...string) DatePicker {
|
||||||
|
if view := ViewByID(rootView, id, ids...); view != nil {
|
||||||
if input, ok := view.(DatePicker); ok {
|
if input, ok := view.(DatePicker); ok {
|
||||||
return input
|
return input
|
||||||
}
|
}
|
||||||
|
@ -265,10 +366,15 @@ func DatePickerByID(rootView View, id string) DatePicker {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// FilePickerByID return a FilePicker with id equal to the argument of the function or
|
// FilePickerByID return the FilePicker path to which is specified using the arguments id, ids. Example
|
||||||
// nil if there is no such View or View is not FilePicker
|
//
|
||||||
func FilePickerByID(rootView View, id string) FilePicker {
|
// view := FilePickerByID(rootView, "id1", "id2", "id3")
|
||||||
if view := ViewByID(rootView, id); view != nil {
|
// view := FilePickerByID(rootView, "id1/id2/id3")
|
||||||
|
//
|
||||||
|
// These two function calls are equivalent.
|
||||||
|
// If a View with this path is not found or View is not FilePicker, the function will return nil
|
||||||
|
func FilePickerByID(rootView View, id string, ids ...string) FilePicker {
|
||||||
|
if view := ViewByID(rootView, id, ids...); view != nil {
|
||||||
if input, ok := view.(FilePicker); ok {
|
if input, ok := view.(FilePicker); ok {
|
||||||
return input
|
return input
|
||||||
}
|
}
|
||||||
|
@ -277,10 +383,15 @@ func FilePickerByID(rootView View, id string) FilePicker {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// CanvasViewByID return a CanvasView with id equal to the argument of the function or
|
// CanvasViewByID return the CanvasView path to which is specified using the arguments id, ids. Example
|
||||||
// nil if there is no such View or View is not CanvasView
|
//
|
||||||
func CanvasViewByID(rootView View, id string) CanvasView {
|
// view := CanvasViewByID(rootView, "id1", "id2", "id3")
|
||||||
if view := ViewByID(rootView, id); view != nil {
|
// view := CanvasViewByID(rootView, "id1/id2/id3")
|
||||||
|
//
|
||||||
|
// These two function calls are equivalent.
|
||||||
|
// If a View with this path is not found or View is not CanvasView, the function will return nil
|
||||||
|
func CanvasViewByID(rootView View, id string, ids ...string) CanvasView {
|
||||||
|
if view := ViewByID(rootView, id, ids...); view != nil {
|
||||||
if canvas, ok := view.(CanvasView); ok {
|
if canvas, ok := view.(CanvasView); ok {
|
||||||
return canvas
|
return canvas
|
||||||
}
|
}
|
||||||
|
@ -289,24 +400,15 @@ func CanvasViewByID(rootView View, id string) CanvasView {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// AudioPlayerByID return the AudioPlayer path to which is specified using the arguments id, ids. Example
|
||||||
// TableViewByID return a TableView with id equal to the argument of the function or
|
//
|
||||||
// nil if there is no such View or View is not TableView
|
// view := AudioPlayerByID(rootView, "id1", "id2", "id3")
|
||||||
func TableViewByID(rootView View, id string) TableView {
|
// view := AudioPlayerByID(rootView, "id1/id2/id3")
|
||||||
if view := ViewByID(rootView, id); view != nil {
|
//
|
||||||
if canvas, ok := view.(TableView); ok {
|
// These two function calls are equivalent.
|
||||||
return canvas
|
// If a View with this path is not found or View is not AudioPlayer, the function will return nil
|
||||||
}
|
func AudioPlayerByID(rootView View, id string, ids ...string) AudioPlayer {
|
||||||
ErrorLog(`TableViewByID(_, "` + id + `"): The found View is not TableView`)
|
if view := ViewByID(rootView, id, ids...); view != nil {
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// AudioPlayerByID return a AudioPlayer with id equal to the argument of the function or
|
|
||||||
// nil if there is no such View or View is not AudioPlayer
|
|
||||||
func AudioPlayerByID(rootView View, id string) AudioPlayer {
|
|
||||||
if view := ViewByID(rootView, id); view != nil {
|
|
||||||
if canvas, ok := view.(AudioPlayer); ok {
|
if canvas, ok := view.(AudioPlayer); ok {
|
||||||
return canvas
|
return canvas
|
||||||
}
|
}
|
||||||
|
@ -315,10 +417,15 @@ func AudioPlayerByID(rootView View, id string) AudioPlayer {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// VideoPlayerByID return a VideoPlayer with id equal to the argument of the function or
|
// VideoPlayerByID return the VideoPlayer path to which is specified using the arguments id, ids. Example
|
||||||
// nil if there is no such View or View is not VideoPlayer
|
//
|
||||||
func VideoPlayerByID(rootView View, id string) VideoPlayer {
|
// view := VideoPlayerByID(rootView, "id1", "id2", "id3")
|
||||||
if view := ViewByID(rootView, id); view != nil {
|
// view := VideoPlayerByID(rootView, "id1/id2/id3")
|
||||||
|
//
|
||||||
|
// These two function calls are equivalent.
|
||||||
|
// If a View with this path is not found or View is not VideoPlayer, the function will return nil
|
||||||
|
func VideoPlayerByID(rootView View, id string, ids ...string) VideoPlayer {
|
||||||
|
if view := ViewByID(rootView, id, ids...); view != nil {
|
||||||
if canvas, ok := view.(VideoPlayer); ok {
|
if canvas, ok := view.(VideoPlayer); ok {
|
||||||
return canvas
|
return canvas
|
||||||
}
|
}
|
||||||
|
@ -327,10 +434,15 @@ func VideoPlayerByID(rootView View, id string) VideoPlayer {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ImageViewByID return a ImageView with id equal to the argument of the function or
|
// ImageViewByID return the ImageView path to which is specified using the arguments id, ids. Example
|
||||||
// nil if there is no such View or View is not ImageView
|
//
|
||||||
func ImageViewByID(rootView View, id string) ImageView {
|
// view := ImageViewByID(rootView, "id1", "id2", "id3")
|
||||||
if view := ViewByID(rootView, id); view != nil {
|
// view := ImageViewByID(rootView, "id1/id2/id3")
|
||||||
|
//
|
||||||
|
// These two function calls are equivalent.
|
||||||
|
// If a View with this path is not found or View is not ImageView, the function will return nil
|
||||||
|
func ImageViewByID(rootView View, id string, ids ...string) ImageView {
|
||||||
|
if view := ViewByID(rootView, id, ids...); view != nil {
|
||||||
if canvas, ok := view.(ImageView); ok {
|
if canvas, ok := view.(ImageView); ok {
|
||||||
return canvas
|
return canvas
|
||||||
}
|
}
|
||||||
|
@ -339,10 +451,15 @@ func ImageViewByID(rootView View, id string) ImageView {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// TableViewByID return a TableView with id equal to the argument of the function or
|
// TableViewByID return the TableView path to which is specified using the arguments id, ids. Example
|
||||||
// nil if there is no such View or View is not TableView
|
//
|
||||||
func TableViewByID(rootView View, id string) TableView {
|
// view := TableViewByID(rootView, "id1", "id2", "id3")
|
||||||
if view := ViewByID(rootView, id); view != nil {
|
// view := TableViewByID(rootView, "id1/id2/id3")
|
||||||
|
//
|
||||||
|
// These two function calls are equivalent.
|
||||||
|
// If a View with this path is not found or View is not TableView, the function will return nil
|
||||||
|
func TableViewByID(rootView View, id string, ids ...string) TableView {
|
||||||
|
if view := ViewByID(rootView, id, ids...); view != nil {
|
||||||
if canvas, ok := view.(TableView); ok {
|
if canvas, ok := view.(TableView); ok {
|
||||||
return canvas
|
return canvas
|
||||||
}
|
}
|
||||||
|
|
|
@ -421,8 +421,8 @@ func (bridge *webBridge) remoteValue(funcName string, args ...any) (DataObject,
|
||||||
|
|
||||||
funcArgs := append([]any{answerID}, args...)
|
funcArgs := append([]any{answerID}, args...)
|
||||||
var result DataObject = nil
|
var result DataObject = nil
|
||||||
ok := bridge.callFuncImmediately(funcName, funcArgs...)
|
|
||||||
if ok {
|
if bridge.callFuncImmediately(funcName, funcArgs...) {
|
||||||
result = <-answer
|
result = <-answer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue