Git Product home page Git Product logo

Comments (9)

jmuncaster avatar jmuncaster commented on May 29, 2024 1

Working well for us, thanks!

from cvui.

Dovyski avatar Dovyski commented on May 29, 2024

Thank you! I am glad you like and find it useful.

Regarding your question, yes, at the moment it is not possible to capture clicks and interactions of cvui components in more than one window. However it is possible to use cvui in more than one window at the time (since the rendering is not attached to any window).

My current project also needs the feature you suggested, so I definitely plan to support it in the near future. I already have some ideas for how to implement this with minimal additions to the existing API.

from cvui.

Dovyski avatar Dovyski commented on May 29, 2024

@jmuncaster I've just added support for multiple windows in cvui.

The API is not final and I still need to document this new feature, but the overall idea is to call cvui components of a particular window between cvui::context(WINDOW_NAME) and cvui::update(WINDOW_NAME):

#define WINDOW1 "window1"
#define WINDOW2 "window2"

main() {
  // new cvui::init() function allows automatic creation of windows
  const cv::String windows[] = { WINDOW1, WINDOW2 };
  cvui::init(windows, 2);

  cvui::context(WINDOW1);
  // render components of WINDOW1 here
  cvui::update(WINDOW1);

  cvui::context(WINDOW2);
  // render components of WINDOW2 here
  cvui::update(WINDOW2);
}

That way cvui knows that which components belong to which window. I added two new examples (here and here) showing how to use cvui with multiple windows.

I would appreciate any feedback on the API and if it works for your needs.

from cvui.

jmuncaster avatar jmuncaster commented on May 29, 2024

Looks good, I'll try it out!

from cvui.

4xle avatar 4xle commented on May 29, 2024

@Dovyski FYI: Tried running both linked examples and getting two errors from the latest dev-branch:
'gMouse': is not a member of 'cvui::internal' cvui.h 1894
'gMouse': undeclared identifier cvui.h 1894.

On a hunch, I checked a diff and static cv::Point gMouse; appears to have been removed from the internal namespace which was breaking the examples(for me, at least). Not sure if you have other plans, but I added it back in and examples ran fine.

from cvui.

Dovyski avatar Dovyski commented on May 29, 2024

Thank you for the heads up, @4xle ! The dev build broke because I recently merged a pull request that uses a mouse structured that is being transitioned to a new format (more robust). I will check on it soon.

from cvui.

Dovyski avatar Dovyski commented on May 29, 2024

I've finished the support for multiple windows in cvui. Thanks for all the help! I added three examples covering different use cases of multiple windows, i.e. multiple-windows, multiple-windows-complex, and multiple-windows-complex-mouse.

Since the work is finished, I'm closing this issue. Please feel free to continue posting here if you have anything to add. If you have found a bug, please open a new issue so I can keep track of things more easily.

from cvui.

k-toffel avatar k-toffel commented on May 29, 2024

Hey,
I have a bit of a problem with multiple windows. I have a bunch of buttons. When a button is pressed I need to do some checks, if the check is unsuccessfull an error window should pop up.
Everything works fine for buttons that aren't grouped, but as soon as they're in a beginRow() / endRow() section I get the error:

[CVUI] Fatal error (code 2): Calling update() before finishing all begin*()/end*() calls. Did you forget to call a begin*() or an end*()? Check if every begin*() has an appropriate end*() call before you call update().

I had a quick look and found out that the error occures during the update() call for the error window. I guess a possible solution would be to add a "gStack" and it's "gStackCount" to the context type.

from cvui.

Dovyski avatar Dovyski commented on May 29, 2024

Thank you for the report and all the additional information, @k-toffel! I've have opened a new issue to keep track of this bug. Your suggestion on how to fix the problem seems spot on. I will work on it.

from cvui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.