Websdk 2 : what replaces FrameworkPropertyChanged?

if my webuicontrol appearence changes, how do I force the browser to update the control ?
updatebrowser and updatecontrol does nothing.


Nothing in the Xojo side. This should be handled in the JavaScript class currently.

let’s imagine the webuicontrol is a button.
I successfully draw the button on my page.
I want to change the button caption, it should be sended by the Serialize event ?
how do I tell the browser to update the page , and so send the serialize event to my xojo code ?

Public Property Caption as String
  return mCaption
End Get

  mCaption = value
  // Use UpdateBrowser to mark the control dirty and push changes to the browser
End Set

End Property
1 Like

I already tried updateBrowser and also UpdateControl, but both do nothing on my webuicontrol …
did you succeed with your controls and websdk 2 to update the browser ?

another question: how do you get to your class datas on the javascript side, using the developper panel in the browser ? I reached my class, but did not find the 3 attributes I created.

Works as expected here. Without seeing your JS class code to apply the change that’s being sent and your serialize event, I can’t really help you troubleshoot. I can tell you that I spent yesterday working up a full example.

You need to create the properties on the class that you’ll need using the constructor in your JS class:

        constructor(id, events) {
            super(id, events);
            this.mCaption = "";

Then, in the updateControl method of your JS class, which is called using the data from your Xojo-side serialize event:

        updateControl(data) {
            let js = $.parseJSON(data);
            this.mCaption = js.caption;

And you update the DOM elements in the JS render method of your class:

        render() {
            let el = this.DOMElement();
            if (!el)
            el.innerHTML = this.mCaption;

So your Xojo-side Serialize event would look like:

Sub Serialize(js as JSONItem) Handles Serialize
  // Add your values to the response here
  js.Value("caption") = mCaption
End Sub
1 Like

I’ve done almost all you’ve kindly described here.
so my mistake must be that I don’t send the correct data with json.
so how do you read your actual data ( the “mCaption” ) using the developper pane of the browser ?

Probably the easiest way is to add the following line to your updateControl JS method:


Then, when you have the dev tools open and the JS engine hits that line, it’ll break and you can inspect both the stack and variables.

1 Like

It’s also worth noting that, if you have errors in your JavaScript, your code may fail to execute fully and you should check the DevTools console for those error messages.

to come where I am with my WebUIControl, I’ve already noticed (many times !) the red dot in the top right debugger panel ! but thanks for reminding it to other readers.

1 Like

well I found my mistake…
never copy examples without understanding what every part (of javascript in my case) does !

I drawed the control with render at first pass, but never at the next passes.

1 Like