Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabled very basic mouse support #34

Merged
merged 1 commit into from
Jan 23, 2016
Merged

Enabled very basic mouse support #34

merged 1 commit into from
Jan 23, 2016

Conversation

hazbo
Copy link
Contributor

@hazbo hazbo commented Dec 11, 2015

I see this as work in progress, for now. In terms of the public API, all the
end user has to do is something like g.EnableMouse = true. I think this is
reasonable and may not have to really change. Although I think the way it's
used with KeyBindings should maybe be changed. We need to expose the X and Y of
the click event - I'm not sure if this is possible currently, although Gui has
an unexported event field of type termbox.Event that I believe contains this
information.

Mouse support is something I need for a project I'm using Gocui, I noticed
there was an issue open in relation to this so I figured I'd send back what
I've started already.

Thanks for making gocui - it's awesome.

I see this as work in progress, for now. In terms of the public API, all the
end user has to do is something like g.EnableMouse = true. I think this is
reasonable and may not have to really change. Although I think the way it's
used with KeyBindings should maybe be changed. We need to expose the X and Y of
the click event - I'm not sure if this is possible currently, although Gui has
an unexported event field of type termbox.Event that I believe contains this
information.

Mouse support is something I need for a project I'm using Gocui, I noticed
there was an issue open in relation to this so I figured I'd send back what
I've started already.

Thanks for making gocui - it's awesome.
@hazbo
Copy link
Contributor Author

hazbo commented Dec 11, 2015

I realise that mouse clicks and key bindings don't sounds like they go together so much - however termbox seems to group them together, sort of. Do you think mouse events should be kept a bit more separate from that standard keybinding stuff you've already written?

They way I've done it so far would allow the user to do something like this

if err := g.SetKeybinding("main", gocui.MouseLeft, gocui.ModNone, doSomething); err != nil {
    return err
}

@jroimartin jroimartin merged commit c36dfef into jroimartin:master Jan 23, 2016
@jroimartin
Copy link
Owner

First of all, sorry for my late response! I've been really busy working on other projects.

On the other hand, thanks for your contribution. I have added full mouse support in faa12e1 based on your initial work. Basically it allows to bind mouse buttons to views (or globally) and detects which View have been clicked before executing the matching keybinding. What do you think? :)

@jroimartin
Copy link
Owner

@hazbo
Copy link
Contributor Author

hazbo commented Jan 29, 2016

Hey, sorry it's taken a while for me to get back to this. I've had a look and I think it's great. This is the sort of thing that will be great for menus, dialog windows, buttons and that sort of thing etc...

cswank pushed a commit to cswank/gocui that referenced this pull request Oct 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants