Skip to content

Row widget: strange behaviour when using CustomWidget #572

Closed

Description

@gucio321

What happend?

when using CustomWidget inside RowWidget (especially as a last of the widgets), imgui.SameLine() is called incorrectly.

Code example

main.go
giu.Row(
   giu.Label("Hi!"),
   giu.Custom(func() { fmt.Println("Hello world!") }),
),
giu.Label("I'll be next to Hi label... - it shouldn't happen"),

To Reproduce

  1. Run my demo
  2. You'll see that both labels are in the same line

Version

(latest)

OS

fedora workstation 36

Activity

  1. gucio321 commented on Oct 18, 2022

    @gucio321
    CollaboratorAuthor

    @AllenDang what do you think about the following solution, I've tought about:
    in (*RowWidget).Build:

    • before rendering widget save giu.GetCursorPos()
    • render widget
    • check if new CursorPos is diffrent and (if so) call imgui.Sameline

    sadly, it could affect performency... maybe add something like giu.Row(...).AutoDetectCursorMove(true)?

  2. AllenDang commented on Oct 19, 2022

    @AllenDang
    Owner

    @gucio321 RowWidget has a list of types inside to decide whether to call SameLine or not, I think this is the best solution right now to leverage performance.

  3. gucio321 commented on Jul 10, 2024

    @gucio321
    CollaboratorAuthor

    I think we can close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ 换网址