Creating your own gui button

For my project i need to build Imaged Buttons, for selecting my brushes. My Window for brushes is a window, and not a child window, inside the drawing window.
I didnt find any access of how a ImGui button is constructed, i presume its pure C-Sharp.

So, if there is no simple way to get images inside a button (wich i didnt find), i m facing a trouble: how to get my home made button position, to code the interaction with mouse , with the peculiar structure of imgui ?

Thank you !!!



founded a dirty way, without mouse job by hiding a checkbutton under my image, but i have troubles with same line and to tine options

for arranging things im now using a table:

I have still a trouble with the part of the image : how can i avoid iits outgoing from the window ?

Hi Karistouf,

it looks like the VL.ImGui.Stride has a bug with clipping LayerWidget.
Ah, or LayerWidget works only for the Skia context, it’s coming form VL.ImGui.Skia.

You can use TextureWidget instead to draw textures inside the ImGui.Stride.
Check HowTo ImGui in Stride from the HelpBrowser.

By the way, you could patch your custom-image-button like this:

CustomButton.vl (14.9 KB)

(Note, GetCursorPos returns a position where ImGui will draw its next widget, not to be confused with a mouse position)

Best,
Anton

3 Likes

thank you anton, should i report this bug to devvs ?

Look, I’ve updated my comment with the info about the TextureWidget, I’ll take care about the Issue, if it’s really one.

2 Likes

Some update for anybody searching a trick: GetCursor SetCursor helps really a lot with i m gui.

There is also a trouble with the Renderwidget. Renderwidget is display out of the window if a part of it is contains in the window. @robotanton Thank you a lot for your help, it gaved me a great solution !