Class as dataSet

  1. 5 years ago

    doobox

    8 Jul 2018 User since 2018

    Can a class be a dataSet?
    If so how would you implement that?

    Say for a simple example...
    1 customTemplate containing 1 label. The label text has been exposed as property0 of the customTemplate.
    1 view in window with its template set to be the customTemplate

    1 class in globals "Class1" with a property "welcome" and an init method, self.welcome = "hello world"

    Possible to bind the "welcome" property of "Class1" to the label text "property0" of the custom view?

  2. doobox

    8 Jul 2018 User since 2018

    Having given this a lot of thought, I can see how this would be tricky.
    Just because the class is sitting in the globals it has no instances until it is initiated at least once.

    Here's the a use case, why I considered a class as a data source...

    Lets say I have a picker object, and I want to populate it with static values. I could easily use the builtin data source... but... If I want this static values of the picker to be say 0 to 360 degrees, then that would be a chore to manually enter into the builtin data source, but would be really easy to create a class or even a variable to hold an array of 360 strings.
    But I see no way to populate the picker object with such an array variable or class property at runtime or via a binding.

    I guess I could use a database to hold the 360 values, but it seems overkill for the purpose.

  3. Joel_Eisenstat

    9 Jul 2018 User since 2016

    I agree having a "local" record set to populate pick lists , etc would be very handy. At the moment I am using SQLite supplementing Postgres as my local/private rs. Using SQLIteManager ( Marco's as well ) a sqlite file can be created and dropped into assets and from there be manipulated via a SQLite db object. It seems like a lot of work but actually is easy to implement - create sqlite file ( table ) drop into asset, loop 1 - 360 , populate rs with degrees .
    HTH

  4. marco

    9 Jul 2018 Administrator User since 2016

    @doobox this is something I'd like to have implemented as soon as possible.
    A class derived from a DataSet should be used in the IDE as a built-in DataSet!
    This requires a bit of work under the hood and we are working hard in order to have this powerful functionality released as soon as possible.

or Sign Up to reply!