0 Replies Latest reply on Oct 5, 2011 6:53 AM by clvrmnky

    Techniques for minimizing control flicker

    clvrmnky Level 4

      Ok, so I have a dialogue (the Plugin Manager dialogue, to be precise) that I've added a button to that is, by default, disabled. I've hooked a listener up to the properties table passed in to enable it. I notice that this button flickers when the dialog is restarted.

       

      e.g., I have this typical sort of arrangement:

       

      local function sectionsForTopOfDialog( f, properties )

       

           properties.button_enabled = false

       

           [...]

       

           local function updateUI()

                LrTasks.startAsyncTask( function()      -- Having this here doesn't make a difference.

                     -- LrTasks.yield()                 -- Nor this, as expected!

                     [...]

                     properties.button_enabled = true

                     [...]

                end, "Fnord")

           end

       

           properties:addObserver('somethinginteresting', updateUI)

           updateUI()

       

           return { { ... f:push_button bound to "button_enabled" ... }}

      end

       

      The problem is that this button will be enabled immediately, and then disabled. This sort of flickers or flashes the control.

       

      I've tried various ways to minimize this, but can't quite figure it out. Anyone have any good ideas?