Inheriting standard widgets with WDTC

Hi,
inheriting widgets was fairly easy with the old WDTC, but with 6 this has become more difficult. Do we have any example what the correct way of inheriting standard widgets would look like? I am struggling with define and function calls and what files I need to copy and what files I can reference. An example for a more advanced widget ex. DropDownBox would really help.

Thx

Stephan

Hi Stephan,

I still don’t know if there is a really correct way to do it.
I will take a look at a potential python script to copy existing widget to a widget lib.
By taking you example of the DropDownBox, if we copy existing DropDownBox (with dependencies) change all declarations to match current lib, you should be able to to the inheriting as before (because widget you inherit is in your lib).
It’s an idea, I need to test it :slight_smile:

If this idea is working I will update this post :slight_smile:

I keep you in touch

Regards,
Florent

1 Like

Hi Florent,
I tried to copy the whole widget but that does not work either. Inside the lib are other references back to the standard brease that fail. I am back to the numeric widget but I cant even get that to work…I followed the documentation for inheriting widgets but something is still missing. AS opens fine but I cant add the widget to a content and when I use the text editor it downloads fine but still throws errors.

brXtended.zip (67.7 KB)

Here is where I am right now…AS tells me

and Browser says

I am sure its something stupid and simple but I dont see it…

Hi Stephan,

Did you register your widget ?
From external lib you need to, I didn’t remember if it’s in documentation but here is the way I register my widget in MV6 (at the end of the file of the widget javascript file):

    //========================================================================
    // WIDGET REGISTRATION
    // ========================================================================

    if (window.lib_br?.controller?.widgetRegistry) {
        lib_br.controller.widgetRegistry.define(
            "widgets.3dviewer.ThreejsViewer",
            WidgetClass
        );
    }

    return WidgetClass;

I still don’t know if it’s the correct to do it, but for me it’s working so I think it’s the workaround.

Regards,
Florent

Hi @stephan.stricker, have you solved your issue?

Yes, I solved it with this

Inheriting basic widgets - Widget Development Tool Chain - B&R Community

1 Like