2 Replies Latest reply on Apr 12, 2010 12:49 PM by Lichtzeichenanlage

    Initialize Values in Dialogs

    Lichtzeichenanlage Level 1

      Hi,

       

      I am totaly new to LUA and to the LR SDK. My question is trivial but gives me a hard time. How can give me a helping hand?

       

      I want to initialize the slider and the linked edit field with 100. But currently I do have no idea to do that.

      local LrFunctionContext = import 'LrFunctionContext'

      local LrBinding = import 'LrBinding'

      local LrDialogs = import 'LrDialogs'

      local LrView = import 'LrView'

                

      ImageSizeInPercentExportDialogSections = {}

       

      function ImageSizeInPercentExportDialogSections.sectionsForBottomOfDialog( f, propertyTable )

           return {

           

                {

                

                -- Add a property to each table

       

                     title = LOC "$$$/ImageSizeInPercent/Info/PluginName=Image Size in Percent",

                     

                     f:column {

                          spacing = f:control_spacing(),

                          fill_horizontal = 1,

       

                          f:row {

                               f:static_text {

                                    title = LOC "$$$/ImageSizeInPercent/Dialog/TargetSizeInPercent=Target size in Percent:",

                                    alignment = 'right',

                               },

                               f:slider {

                                    value = LrView.bind( "targetSizeInPercent" ),

                                    min = 0,

                                    max = 100,

                                    width = LrView.share( "slider_width" ),

                                    tooltip = LOC "$$$/ImageSizeInPercent/Dialog/TargetSizeInPercentToolTip=Enter the target size in percent or use the slider to set the value interactivly.",

                               },

       

                               f:edit_field {

                                    value = LrView.bind( "targetSizeInPercent" ),

                                    width_in_digits = 7,

                                    tooltip = LOC "$$$/ImageSizeInPercent/Dialog/TargetSizeInPercentToolTip=Enter the target size in percent or use the slider to set the value interactivly.",

                               },          

                          },

                     },

                },

           }

      end

        • 1. Re: Initialize Values in Dialogs
          JW Stephenson Level 4

          Your code is hard to read with the "&n bsp;" characters posted on every line - not sure what that is for.  In any case, look at page 82 of the LR2 SDK manual and you will see the use of a properties table with the LRBinding class.  That would be one place you could store the value of the slider both initially and as you change it.  There are other methods but I think this is what you might be looking for.

           

          Good luck.  I am sure you have found out this process is a lot of trial and error.

           

          Jeff

          • 2. Re: Initialize Values in Dialogs
            Lichtzeichenanlage Level 1

            Hi Jeff,

             

            sry for that bad formated code. As I copied it into this editor, everything looked fine and I haven't checked the Text after I have presed "post message".

             

            Thx for your answer - It leads me to the right page.

             

            rgds - Anders