Comments (2)
Controls are only redrawn/updated when required (changing position, size, etc)
void CheckBox::SetChecked( bool checked ) {
if( checked_ != checked ) {
checked_ = checked;
checkedChangedEvent_.Invoke( this );
Invalidate(); // tells the renderer to redraw the control.
}
}
Lets say you have a checkbox that is initialized with the variable epic_bool
from your settings struct, when and if the epic_bool
is updated, the checkbox will not reflect this change automatically.
You can manually update the checkbox by calling SetChecked( epic_bool )
which in return will redraw the checkbox. If you want something more automated you could use OSHGui::Timer
to call
the SetChecked( epic_bool )
function every 250 milliseconds or so.
auto timer = new OSHGui::Timer();
timer->SetInterval( 250 );
timer->Start();
parent->AddControl( timer );
timer->GetTickEvent() += OSHGui::TickEventHandler( [ this, epic_bool ]( Control *sender ) {
this->SetChecked( epic_bool );
});
However this isn't the best approach simply for the fact it's needlessly redrawing the control. Perhaps you can think of something better so you only need to redraw the checkbox when needed.
If you have any further questions, don't hesitate to ask.
from deadcell-oshgui.
Hello, I ended up doing what you suggested
Manually updating the components
It seems to be quite dirty but oh well, atleast it works.
Thanks for the help.
from deadcell-oshgui.
Related Issues (5)
- Loader 0 bytes in size HOT 1
- outlets.png does not exist. HOT 1
- problem the window movement HOT 14
- doesn't open? HOT 1
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 deadcell-oshgui.