Coder Social home page Coder Social logo

Comments (3)

mikke89 avatar mikke89 commented on September 4, 2024 1

I see, so if I understand correctly, you are unhiding the element, and then manually focusing on it right after. I believe the ElementDocument::Show does the right thing: Updating the layout before the autofocus takes place. However, when you do this manually on some element, this doesn't take place automatically.

I would say the proper approach for users in this case is to manually call ElementDocument::UpdateDocument() right after showing the element. This should take care of the layout before you call focus. You can read more about this here: https://mikke89.github.io/RmlUiDoc/pages/cpp_manual/documents.html#manually-updating-the-document

I've generally delegated the responsibility of updating the layout in special cases like these to the user, mainly due to the combination of: (1) figuring out exactly what needs to be updated based on which changes can be very complicated in the CSS/HTML model, (2) a correct but widely applied dirtying/re-layouting system can have extreme performance implications, (3) a conservative dirtying/re-layouting system can be faster but will likely have many false negatives (unacceptable) unless serious effort is spent on this.

from rmlui.

mikke89 avatar mikke89 commented on September 4, 2024 1

Glad to hear you got it working. I agree it's not ideal, but I believe it's the right trade-off for us right now. In the long-term it would be nice to look at handling such cases automatically, but that is still far off.

from rmlui.

ShawnCZek avatar ShawnCZek commented on September 4, 2024

Thank you for the quick and detailed response. I thought the UpdateDocument method was private for some reason. Anyway, replicating the behavior of the ElementDocument::Show you brought up fixed the issue for me.

The only problem is that a data variable managed the state. Now, I have to manage the state programmatically as data models are processed by the context and not by the document, of course.

Regarding the library, I understand and quite agree with how things are right now. But then the obvious problem is when some events are queued for the context update, and other events are processed immediately. There is no silver bullet for this, sadly.

from rmlui.

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.