• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

Break code of dialogbox into smaller parts

Explorer ,
Feb 25, 2024 Feb 25, 2024

Copy link to clipboard

Copied

I have a quite a large dialogbox, and for code maintaining or adding future options. I would like to break this up in several code pieces.

 

LrFunctionContext.callWithContext ("Main", function (context)
		local f = LrView.osFactory ()
		local properties = LrBinding.makePropertyTable (context)
		-------- Default values for boxes --------
		properties.SourceDir 			= ""
		properties.NewFileName 			= ""
		properties.KeepOriginalFile 	= "noKeepOriginalFile"
		properties.MergeExif 			= "yesMergeExif"
		properties.NewFileExtention 	= "tif"
		properties.CreateExifToolDir 	= "yesCreateExifToolDir"
		properties.SaveNotes 			= "noSaveNotes"
		--------- Get the default browse folder--------
		defaultFolder 					= AFConfigFunctions.readConfig("export")
		
		--------- Show the dialog window --------
	local result = LrDialogs.presentModalDialog {
			title = "Metadata import",
			contents = f:column {
				spacing 		= f:label_spacing(),
				fill_horizontal = 1,
				font 			= "<system>",
				bind_to_object 	= properties,
				
				AFMetadataInsertDialog.ShowLogo(f)

But I always get errors.

function AFMetadataInsertDialog.ShowLogo(f)
	return 
		
			{
			-------- Logo --------
			f:row {
				alignment 	= "right",
				margin_left = "870",
				f:picture {
					value 	= _PLUGIN:resourceId("/img/Logo.png"),
				}
			},
			f:spacer{
				width 	= "100%",
				height 	= "5",
			},	
		}
			
end	

Is this possible and how ?

Patrick

 

 

TOPICS
SDK

Views

34

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Feb 25, 2024 Feb 25, 2024

AFMetadataInsertDialog.ShowLogo(f) must return a single view object, but it is instead returning an array of view objects that gets inserted into the containing column as a single element. Each element of a column must be a view object, not an array of view objects. 

 

Wrap the result of ShowLogo() in a column:

 

function AFMetadataInsertDialog.ShowLogo(f)
    return f:column {
        ...}

 

Votes

Translate

Translate
LEGEND ,
Feb 25, 2024 Feb 25, 2024

Copy link to clipboard

Copied

LATEST

AFMetadataInsertDialog.ShowLogo(f) must return a single view object, but it is instead returning an array of view objects that gets inserted into the containing column as a single element. Each element of a column must be a view object, not an array of view objects. 

 

Wrap the result of ShowLogo() in a column:

 

function AFMetadataInsertDialog.ShowLogo(f)
    return f:column {
        ...}

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines