awesome-gocui / gocui

Minimalist Go package aimed at creating Console User Interfaces.
BSD 3-Clause "New" or "Revised" License
344 stars 39 forks source link

Access other views from EditorFunc #115

Closed rotech closed 2 years ago

rotech commented 2 years ago

I would like to know if it's possible to access another view from an EditorFunc. Basically, depending on what has been entered in the view with the editor, I would like to update a different view.

As a parameter to the EditorFunc, the Gui isn't passed to be able to get a reference to other views, and I can't see how to get it without keeping the Gui in a global.

I guess the other option is to create a Keybinding for all the keys and runes, and implement an editor like that?

Thanks

rotech commented 2 years ago

Sorry, figured it out. I was using EditorFunc, and should have done a function with a pointer receiver and struct to hold any additional variables.