Comments (3)
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.
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.
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)
- RCSS selector escaping HOT 3
- The default GLFW GL3 backend yields weird display HOT 4
- Support for mouseenter and mouseleave events. HOT 3
- Support for Modulus operation in expressions HOT 3
- Rml::Span doesn't exist when RmlUi is installed from vcpkg which leads to backend compilaton errors HOT 2
- Get the ElementText rectangle or bounding box when the layout calculation is complete HOT 3
- Does RmlUI have plans to support dotte/dashed borders style? HOT 2
- Using glEnable(GL_DEPTH_TEST) when using GL3 renderer and SDL platform results in blank screen. HOT 1
- open a link in the web browser? HOT 2
- source code of a game in the rmlui's galery HOT 4
- Nothing renders and app crashes with a minimum example of RmlUI, SDL2, Glad, OpenGL4.6 HOT 3
- Current HarfBuzz sample is not able to render emojis HOT 6
- Document window failed to auto scale after moving HOT 2
- Flex formatting context triggered unexpected assert initial_box_size.y < 0 HOT 2
- Debugging modal documents HOT 4
- nth-child(odd) gets confused by data-if (RmlUi 5.1) HOT 4
- Textures leaked during shutdown HOT 3
- Child doesn't get clipped if width/height is 100% HOT 4
- TranslateX doesn't change the div width HOT 3
- Scroll continuously reverts to the top when another element on the document is updated HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rmlui.