-
-
Notifications
You must be signed in to change notification settings - Fork 136
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
Image menu #474
Comments
@jasmeer could you tell more about what are going to achive? |
@gucio321 Thank you for the reply. Thx |
hmm, it is kind of difficult thing as imgui doesn't suppor that by default (as far as I know 😄 )
|
well, it'll not work - unfortunately ComboCustomWidget doesn't support "custom" preview value - only strings |
ok, @jasmeer it isn't exactly what you're looking for but it could be a nice workaround package main
import (
"fmt"
"image"
"github.com/AllenDang/giu"
)
var img *image.RGBA
func loop() {
giu.Window("my window").Layout(
giu.MainMenuBar().Layout(
giu.ImageWithRgba(img).Size(80, 20),
giu.ContextMenu().MouseButton(giu.MouseButtonLeft).Layout(
giu.Selectable("option1").OnClick(func() { fmt.Println("I was clicked!") }),
),
),
)
}
func main() {
img, _ = giu.LoadImage("gopher.png")
giu.NewMasterWindow("issue 474 [example 1]", 640, 480, 0).Run(loop)
} (remember to put file named gopher.png in the same directory with go file) |
@gucio321 It works. I modified it to use MenuItems. One small issue - menu appears to the right of the image. How do i remove this x offset? I |
@jasmeer thats exactly the problemm with context menu; it gets opened over mouse cursor rather than over widget. |
@gucio321 Thanks. I am using Font Awesome ICON fonts and it is working. I want to use large ICONs; but there is not room in MenuBar. Is it possible to increase the height? Thanks |
@jasmeer sure, check go mod edit -replace github.com/AllenDang/giu=github.com/gucio321/giu@02e72d9237d62767afa1637e6189aeffd2e50b47 |
@jasmeer does this work? |
@gucio321 Is this feature merged in @v0.6.2 ? Thanks |
@jasmeer yep, as far as I see, it is part of v0.6.2. |
@gucio321 It doesn't work. Font size does increase, but the menubar height doesn't change; in effect a portion of the text is outside the bar.
|
I think it is not issue on giu-side since I don't thing this feature is available in Dear ImGui itself |
Hi
Is it possible to attach menu to an image button?
`
`
Thanks
Jasmeer
The text was updated successfully, but these errors were encountered: