0 Replies Latest reply on Apr 6, 2009 2:58 PM by Allen Gambrell

    Open a custom dialog when button is pressed.

    Allen Gambrell

      I have a custom dialog that I want to display another custom dialog. I cannot get it work correctly. Everytime I add a function that will show the 2nd dialog It will show before the 1st one is loaded and then nothing happens when I click the dialog on the first!

       

      I seem to be missing something big? I have not even started to try to get the value of the 2nd dialog and return it to the first!

       

      Any help!!!!?

       

      Here is some of the code

       

      function showAddTokenDialog ()

          LrFunctionContext.callWithContext('showAddTokenDialog', function( context )

              local f = LrView.osFactory()

              tokenprops  = LrBinding.makePropertyTable(context)
              props.token = "val"
              -- Create the contents for the dialog.
             
              local token = LrView.bind('token')
             
              local AddTokenDialog = {
                  bind_to_object = tokenprops,
                  title = "Add Token",
                  actionVerb = "Add Token",
                  actionBinding = LrView.bind('action'),
                  contents = f:row {               
                      f:static_text {
                          alignment = "right",
                          width = LrView.share "label_width",
                          title = "Token "                   
                      },
                      f:popup_menu {
                          value = LrView.bind('val'),
                          items = tokenItems,
                          width_in_chars = 15
                      }
                  }
              }       
             
              result = LrDialogs.presentModalDialog(AddTokenDialog)
             
          end)
      end

       

      function Mine.showCustomDialog()

       

          LrFunctionContext.callWithContext("showCustomDialogWithObserver", function(context)
         
              props = LrBinding.makePropertyTable(context)

       

                local c = f:row {
                                              f:static_text {
                                                  alignment = "right",
                                                  --width = LrView.share "label_width",
                                                  title = "Caption: ",
                                                  width_in_chars = 10
                                              },
                                              f:edit_field {
                                                  --place_horizontal = 0.5,
                                                  --bind_to_object = tableTwo,
                                                  value = '',
                                                  height_in_lines = 2,
                                                  width_in_chars = 20
                                              },
                                              f:push_button {
                                                  title = "Add Token",
                                                  -- When the 'Update' button is clicked
                                                  font = '<system/small>',
                                                  action = showAddTokenDialog ()
                                              },
                                          }

       

                LrDialogs.presentModalDialog(
                  {
                      title = "Barcode Match",
                      contents = c
                  }
              )

       

          end) -- end main function
           end