[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Expected behavior of Class.Load in components


I found a workaround: I added a procedure in which the component can receive the Class object from the project. This exposes the exported classes of the project to the component, and allowed me to easily add a behavior that I was interested in: let the classes defined in the project to "overwrite" specific classes in the component.

El 01/05/25 a las 17:49, Carlos Prieto López escribió:
I programmed a module (which I wish to turn into a component) that dynamically loads clases for different controls. Such classes have methods for dealing with different controls. A very basic example would be a function that returns the "value" of the control. This would be the Text property for a label or textbox, Checked for checkbox, and others for other controls. My goal is that I can add such "controllers" for some basic controls, but may add classes to the project that allow me to interact with other controls, without the need to modify the code of the component.

I have other examples of my need for this, but I hope this clarifies the idea.


El 1 de mayo de 2025 5:27:48 p.m. CST, "Benoît Minisini" <benoit.minisini@xxxxxxxxxxxxxxxx> escribió:

    Le 02/05/2025 à 00:38, Carlos Prieto a écrit :

        Hi!

        I created a component with a function F that uses the Class.Load
        function, with an argument passed to the function F. Inside the
        project of the component, it works as expected with any class
        defined within that project.

        However, when I pack the component and include it in another
        project by Project > Properties > Components, the function
        raises an error

        "Impossible to load class 'X': File or directory does not exist."

        if X is a class defined in the project.

        Is this the expected behavior?
        How could I load such a class from the component?

        Thanks in advance.



    Class.Load() can only load a class from the component where it is
    called.

    Why do you want to ask a component to load a class from the main
    project? How can it be useful?



References:
Expected behavior of Class.Load in componentsCarlos Prieto <caprilo@xxxxxxxx>
Re: Expected behavior of Class.Load in componentsBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: Expected behavior of Class.Load in componentsCarlos Prieto López <caprilo@xxxxxxxx>