Application Start event on controls

Questions and information about Crank Software's Storyboard Designer

Moderator: jamiev

Application Start event on controls

Postby ba100 » Fri May 11, 2018 9:23 am

Good morning,


I was wondering if there was a way to apply the Application Start event to individual controls? The event itself only seems to be available for the application layer. I also tried attaching this event on the application to call a lua script which in turned triggered another event "on_init" which I attempted to put onto a control. It did not trigger on the control, but it did trigger for the Application, Screen, and Layer levels.

My main goal is to have each control individually 'register' itself in lua with parameters. So on initialization the control would call a "register_control" lua function which would register its layer, path, control type, size, (callback function name), etc..


Any help would be appreciated
Thank you.
ba100
 
Posts: 2
Joined: Fri May 11, 2018 9:02 am

Re: Application Start event on controls

Postby ba100 » Thu May 17, 2018 8:23 am

Got the answer:

Code: Select all
require("gredom")

function initialize(mapargs)
  local app = gredom.get_application()
  app_c = app:get_children()

  for k,v in pairs(app_c) do
    -- Get get children of this screen
    local screen_c = v:get_children()
    for k1, v1 in pairs(screen_c) do
      -- Get children of this layer
      local layer_c = v1:get_children()
      for k2, v2 in pairs(layer_c) do
         -- v2 will be a control within layer v1
         --Call function to 'register' control here using v2:get_name()
      end
    end
  end
end


Where initialize is called on gre.init within the context of the application. Which enables me to create a table of the controls that exist within the application. (and create control classes from those on startup)
ba100
 
Posts: 2
Joined: Fri May 11, 2018 9:02 am


Return to Storyboard Designer

Who is online

Users browsing this forum: No registered users and 5 guests

cron