ofxUI relative window resizing?

im using ofxUI and its all going well [and more so enjoying being back on oF after some much needed c++ tutorials I’ve been doing ;)], but one main thing i want to do is ‘hook’ the created UIs to specific points on the window.

currently i have set it at this:

which is putting it at the bottom left corner, which is where i want it to stay. but how can i hook it to the bottom corner. so when i resize the window, the controls follow along?


I think you can use controlUI->getRect() to get the drawing rectangle, but you’ll have to readjust every other element in the GUI. I don’t think there’s a way to set relative positioning and sizes. If there is I’d also like to know!

You can listen to the ofEvents().windowResized event using ofAddListener, and then resize your GUI whenever the window is resized. You can also use the ofApp::windowResized function to do this from your main app class.

aaah ‘relative’, couldn’t remember that word. ill update this post title so it makes more sense.
thanks. ill have a go.

if anyone else has a definitive method id love to know :wink:

did get an answer in regard to movie resizing from anothel post i made. which uses ofRectangle to help with scaling.
im going to see about using ofRectangle for relative positioning of ofxUI

ill let you know. but if anyone else can shed, please do :wink:

@lewislepton Have you solved this problem? I’d also very much like to place ofxUI buttons dynamically.

hey man

i have not had the time to be honest. plus cant remember if i did get it. though sadly ofxUI is also not being serviced anymore. so would have to go for something else

No problem, I’m just making my own buttons, but for posterity the windowResized() function gets called every time the window is resized. Adding a custom setup loop in this function for the ofxUI elements could work.