Document how to override default keybindings #14

Closed
opened 2 years ago by tryffel · 4 comments
tryffel commented 2 years ago (Migrated from gitlab.com)
Owner

Hello, first of all thank you very much for the additional widgets you have developed, much appreciated!

I just tried my application on Windows and noticed that by default on cmd Alt+Enter is used for toggling between full screen and normal, thus making ContextMenu unavailable on Windows (at least on default cmd). It would be nice to let user override this shortcut. Thanks!

Hello, first of all thank you very much for the additional widgets you have developed, much appreciated! I just tried my application on Windows and noticed that by default on cmd Alt+Enter is used for toggling between full screen and normal, thus making ContextMenu unavailable on Windows (at least on default cmd). It would be nice to let user override this shortcut. Thanks!
tslocum commented 2 years ago (Migrated from gitlab.com)
Owner

changed title from {-Add option to override contextMenu key Alt+Enter-} to {+Document how to override default keybindings+}

changed title from **{-Add option to override contextMenu key Alt+Enter-}** to **{+Document how to override default keybindings+}**
tslocum commented 2 years ago (Migrated from gitlab.com)
Owner

Thanks @tryffel. The default keybindings are applied permanently but you can add a new keybinding which opens the context menu with https://gitlab.com/tslocum/cbind

// Initialize input configuration
var inputConfig = cbind.NewConfiguration()

func main() {
// app = cview.NewApplication()
// ...

// Create handler
openContext := func(ev *tcell.EventKey) *tcell.EventKey {
	setFocus := func(p cview.Primitive) {
		app.SetFocus(p)
	}
	list.ShowContextMenu(list.GetCurrentItem(), -1, -1, setFocus)
	return nil
}

// Set keybinding
inputConfig.SetRune(tcell.ModNone, 'm', openContext)

// Set input capture
app.SetInputCapture(inputConfig.Capture)

// ...
// app.Run()
}

I'll document these steps more clearly somewhere before closing this.

Thanks @tryffel. The default keybindings are applied permanently but you can add a new keybinding which opens the context menu with https://gitlab.com/tslocum/cbind ```go // Initialize input configuration var inputConfig = cbind.NewConfiguration() func main() { // app = cview.NewApplication() // ... // Create handler openContext := func(ev *tcell.EventKey) *tcell.EventKey { setFocus := func(p cview.Primitive) { app.SetFocus(p) } list.ShowContextMenu(list.GetCurrentItem(), -1, -1, setFocus) return nil } // Set keybinding inputConfig.SetRune(tcell.ModNone, 'm', openContext) // Set input capture app.SetInputCapture(inputConfig.Capture) // ... // app.Run() } ``` I'll document these steps more clearly somewhere before closing this.
tryffel commented 2 years ago (Migrated from gitlab.com)
Owner

Ok, looks cool! I'm waiting for more documentation on this. =)

Ok, looks cool! I'm waiting for more documentation on this. =)
tslocum commented 2 years ago (Migrated from gitlab.com)
Owner

closed via commit fb673aeff6

closed via commit fb673aeff620f9c0235cff5998ea0da10a9e573a
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.