File tree 3 files changed +22
-2
lines changed
3 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,19 @@ func (d *DialogRef) SetContent(i ID) {
22
22
d .a .Apply (& DialogContentChanged {ID : d .ID , ContentID : i , PreviousID : dc .content })
23
23
}
24
24
25
+ func (d * DialogRef ) SetTitle (x string ) {
26
+ s := d .a .s
27
+ t := s .controls [d .ID ].(* dialogCtl ).title
28
+ if t == x {
29
+ return
30
+ }
31
+ d .a .Apply (& DialogTitleChanged {ID : d .ID , Title : x })
32
+ }
33
+
34
+ func (d * DialogRef ) DoSetTitle (x string ) {
35
+
36
+ }
37
+
25
38
func (d * DialogRef ) Show () {
26
39
s := d .a .s
27
40
@@ -50,3 +63,8 @@ type DialogContentChanged struct {
50
63
ContentID ID `json:"contentId"`
51
64
PreviousID ID `json:"previousId"`
52
65
}
66
+
67
+ type DialogTitleChanged struct {
68
+ ID ID `json:"id"`
69
+ Title string `json:"title"`
70
+ }
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ func Test(t *testing.T) {
19
19
d .SetContent (h .ID )
20
20
d .Show ()
21
21
22
+ h .OnClick (d .DoSetTitle ("YEP!" ))
23
+
22
24
time .Sleep (time .Millisecond )
23
25
24
26
}
@@ -31,7 +33,5 @@ func printEvents(c chan interface{}) {
31
33
} else {
32
34
fmt .Printf ("%T: %s\n " , e , string (b ))
33
35
}
34
-
35
36
}
36
-
37
37
}
Original file line number Diff line number Diff line change @@ -30,6 +30,8 @@ func (s *state) apply(e interface{}) {
30
30
case * DialogShown :
31
31
s .top = t .ID
32
32
s .controls [t .ID ].(* dialogCtl ).visible = true
33
+ case * DialogTitleChanged :
34
+ s .controls [t .ID ].(* dialogCtl ).title = t .Title
33
35
default :
34
36
panic ("Unknown event type" )
35
37
}
You can’t perform that action at this time.
0 commit comments