Stategy for detecting if resize grip is pressed

#1

Hi all,

I’m searching for easy ways of checking if the mouse is over the resize grip/button and if the resize button is pressed with mouse. I’ve been searching without finding a good way of checking it but I might have missed something.

0 Likes

#2

What are you trying to achieve with this test? (Asking this is almost always necessary to find the best possible answer)

How about resizing from one of the four borders, or lower-left grip when enabled?

0 Likes

#3

Thanks for your answer,
I’m basically want to be able to use custom code that make use of the buttons instead of the current resize behaviour. Is there a flag or something set when you press resize that you can read from the API? (I don’t want to go into the source and add the functionality if there is a way to “read” their status already).

0 Likes

#4

What would you like this custom code to do?

Why don’t you just disable those buttons and add yours instead? Do you want keyboard/gamepad manipulations of those controls to affect your desired behavior?

0 Likes

#5

I’m want to use them to for a custom scrollable “image list” thingy, and there are obvious many approaches I can take. If there isn’t any way of reading those buttons, disabling and adding my own buttons is obviously a workaround. But since “they are there” already I got curious if there was a way of reading/using them? Being able to read a flag somehow would be all that is needed. I fully understand if it isn’t possible atm(or ever).

0 Likes

#6

It is possible by comparing the active id to the id of those buttons (which is easy to figure out if you look at the code) but you haven’t answered my sets of question above. The reason I’m not giving you an trivial answer is that this is most probably NOT what you should do. The resizing buttons can be activated in many ways and there are also resizing borders involved. And is still unclear how you intend to use those buttons (how are you going to react to how they are pressed?). It is also trivial to just disable them and create another custom button instead and you wouldn’t run into those other issues.

0 Likes

#7

Oh sorry about that. What I wanted was to be able to know when an resize event was happening and only then get the position of the “new size” and insert the number of empty image-slots(new ImGui windows) that “fit” in that direction(when resizing right & left mainly) into an existing list of image windows. The window with the “resize functionality” is see through and positioned over the image list and should snap back to the original size after executing code that does the above. Clicking on a image window will move the “resize window” over that image. My workaround now works but my guess is that the code could be a whole lot cleaner with a resize flag/event. Anyway reading the active id seems like it could be the way to go. Thank you.

0 Likes