🐛 Handle key events globally
This commit is contained in:
		
							parent
							
								
									c776ed21bd
								
							
						
					
					
						commit
						247c750932
					
				
							
								
								
									
										8
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								main.go
									
									
									
									
									
								
							@ -95,10 +95,10 @@ func main() {
 | 
			
		||||
			return len(currentEntries)
 | 
			
		||||
		},
 | 
			
		||||
		func() fyne.CanvasObject {
 | 
			
		||||
			tn := canvas.NewText("Dummy", theme.TextColor())
 | 
			
		||||
			tn := canvas.NewText("Dummy", theme.ForegroundColor())
 | 
			
		||||
			tn.TextStyle.Bold = true
 | 
			
		||||
 | 
			
		||||
			td := canvas.NewText("Dummy", theme.TextColor())
 | 
			
		||||
			td := canvas.NewText("Dummy", theme.ForegroundColor())
 | 
			
		||||
			td.TextSize = theme.TextSize() * 8 / 10
 | 
			
		||||
 | 
			
		||||
			return container.NewHBox(
 | 
			
		||||
@ -124,6 +124,7 @@ func main() {
 | 
			
		||||
 | 
			
		||||
	l.OnSelected = func(id widget.ListItemID) {
 | 
			
		||||
		currentId = id
 | 
			
		||||
		w.Canvas().Focus(e)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	e.OnChanged = func(s string) {
 | 
			
		||||
@ -184,6 +185,9 @@ func main() {
 | 
			
		||||
		}
 | 
			
		||||
		return false
 | 
			
		||||
	}
 | 
			
		||||
	w.Canvas().SetOnTypedKey(func(event *fyne.KeyEvent) {
 | 
			
		||||
		e.onKeyTyped(event)
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
	w.Canvas().Focus(e)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user