I have many computed properties on the WebSDK controls.
Sometimes changing a computed property can require a ton of changes to the control such that its HTML needs to be re-rendered completely.
The getter often looks something like:
Set
mFocusStyle = value
if ControlAvailableInBrowser then
Render?
end
End Set
The problem is when the user changes several of the more complicated properties in a row:
mySpriteButton.Sprite = sprite1
mySpriteButton.SpriteHover = sprite2
mySpriteButton.SpritePressed = sprite3
I don’t want the control to reprocess and send the rendering of the control three times.
I could build in something like this to prevent the issue:
mySpriteButton.PreventRendering = true
mySpriteButton.Sprite = sprite1
mySpriteButton.SpriteHover = sprite2
mySpriteButton.SpritePressed = sprite3
mySpriteButton.PreventRendering = false
mySpriteButton.Render?
But the problem with this way is that it makes utilizing the control complicated and difficult to communicate/educate this with others.
Is there possibly a better way around this built in that I’m missing?
Would it be possible to add something into the framework and the WebSDK to mark a WebControl as “dirty” and to have the session only get the changes once?