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

[bug] Missing MouseButton function for ContextMenu on docking branch #609

Closed
SeyRyuu opened this issue Nov 28, 2022 · 7 comments · Fixed by #628
Closed

[bug] Missing MouseButton function for ContextMenu on docking branch #609

SeyRyuu opened this issue Nov 28, 2022 · 7 comments · Fixed by #628
Labels
bug Something isn't working Docking Features from ImGui's "docking" branch

Comments

@SeyRyuu
Copy link

SeyRyuu commented Nov 28, 2022

What happend?

I just wanted to use the MouseButton func of the ContextMenu widget on the docking branch and noticed that this function is missing. Did the way of using the ContextMenu changed, or is this function missing in the docking branch?

The code example below works fine when using master branch instead.

Kind regards

Code example

main.go
package main

import (
	g "github.com/AllenDang/giu"
)

func main() {
	wnd := g.NewMasterWindow("Testing", 600, 400, 0)
	wnd.Run(loop)
}

func loop() {
	g.SingleWindow().Layout(
		g.Label("Click here"),

		//".MouseButton(...)" is missing
		//"g.MouseButtonLeft" can be replaced with "cimgui.ImGuiMouseButton_Left" on docking)
		g.ContextMenu().MouseButton(g.MouseButtonLeft).Layout(
			g.Label("I'm a context menu"),
		),
	)
}

To Reproduce

  1. Switch to docking branch
  2. Run my demo
  3. Your IDE or at last your compiler will show you the missing .MouseButton(...) part

Version

docking

OS

Windows 11 x64, Ubuntu x64

@SeyRyuu SeyRyuu added the bug Something isn't working label Nov 28, 2022
gucio321 added a commit to gucio321/giu that referenced this issue Nov 28, 2022
- Events.go: wrapps cimgui events detection
- EventHandler.go: giu version of event handler
- Keycode.go: now contains a few more things, e.g. HoveredFlags
- add (*ContextMenu).MouseButton(...); fix AllenDang#609
@SeyRyuu
Copy link
Author

SeyRyuu commented Nov 28, 2022

Hey @gucio321
thanks for the quick PR to fix this issue and the migration of more stuff ^^

@SeyRyuu
Copy link
Author

SeyRyuu commented Nov 29, 2022

Hey @gucio321
working fine now, thank you. Also to @AllenDang for quick merging!

@SeyRyuu SeyRyuu closed this as completed Nov 29, 2022
@SeyRyuu
Copy link
Author

SeyRyuu commented Nov 29, 2022

Hey @gucio321
hehe, need to go one step back ^^. I just wanted to use the ContextMenu with func .MouseButton(g.MouseButtonLeft) and it won't work with the left mouse button, you need to press the right one.

Is this problem because of these lines?
https://github.com/AllenDang/giu/pull/610/files#diff-af8cfbd7fe7309c86f3dc1bd92d3342dac333f1342117db6f14b0e9a1b4a5b33R248-R249

@SeyRyuu SeyRyuu reopened this Nov 29, 2022
@gucio321
Copy link
Collaborator

oh, yah, sorry, forgot about changing it there 😄

@gucio321
Copy link
Collaborator

ugh, wait @SeyRyuu after looging at cimgui.ImGuiPopupFlags, I see that mouse button (and a few more things) are set by these flags, so you need to use them instead MouseButton()

@AllenDang should we adjust MouseButton function here and make it working with these flags, or rather remove it and let user use flags to set mouse button?

@SeyRyuu
Copy link
Author

SeyRyuu commented Nov 30, 2022

Hey @gucio321
thanks for the hint, using g.ContextMenu().Flags(cimgui.ImGuiPopupFlags_MouseButtonLeft) for example works fine.

But, i would say that the .MouseButton(...) fuction is the more easier way than using the flags and also the same way to change the mouse button in master-branch, but let this @AllenDang decide.

@AllenDang
Copy link
Owner

@gucio321 i think mousebutton function is better.

@gucio321 gucio321 added the Docking Features from ImGui's "docking" branch label May 9, 2023
@gucio321 gucio321 linked a pull request May 9, 2023 that will close this issue
69 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Docking Features from ImGui's "docking" branch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants