Adobe 65007312 Programming Guide - Page 84

Creating custom dialog boxes, User interface elements, Containers

Page 84 highlights

CHAPTER 5: Creating a User Interface for Your Plug-in User interface elements 84 X Confirmations and prompts In addition to your text message, these dialogs have configurable OK and Cancel buttons. These return different values to the invocation function, which you use to decide on the action to be taken. Again, there is a "Don't show again" version. These dialogs are extensible; you can define an optional third button, or a small UI section that you define using LrView; see "Creating custom dialog boxes" on page 84. X Errors You can display a simple error message with a single OK button, or you can wrap an error dialog around a function context, so that if the wrapped function throws an error, the dialog appears. See "Using function contexts for error handling" on page 18. X Platform Open File and Save File You can bring up the platform-defined file-selection dialogs, so that the user can choose a file system location. Creating custom dialog boxes You can use the LrDialogs.presentModalDialog() function to create a completely customized dialog box, which you can, for example, invoke from a menu item that your plug-in adds to the Lightroom menu bar, using one of the menu service items: LrExportMenuItems, LrLibraryMenuItems, or LrHelpMenuItems. Most of the contents of this dialog are defined by an LrView hierarchy that you define. To build the contents of a custom dialog, obtain a factory object using the LrView namespace function LrView.osFactory(). Like the confirmation dialogs, this dialog automatically contains configurable OK and Cancel buttons. You can choose to make this dialog user-resizeable, and can also choose to save its most recent frame size as one of your plug-in settings. The location of the dialog is also saved, if the user moves it. The example code in "Building a basic dialog" on page 110 demonstrates how to build and invoke a custom dialog within a function context. User interface elements This section provides details of the types of container and control nodes you can create with an LrView factory object. Containers When creating a dialog or a section for the Plug-in Manager or Export dialog, you generally begin with a top-level container, then, within that container, create its children. Depending on the complexity of your interface, the children can be nested containers (such as a tabbed view that contains tabbed pages), placement containers (rows and columns), or the visible controls (such as text and buttons). X All containers have the shared view properties listed in "General view properties" on page 91, except as mentioned. X All containers except spacer have the layout properties listed in "Determining layout" on page 107.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204

C
HAPTER
5: Creating a User Interface for Your Plug-in
User interface elements
84
X
Confirmations and prompts
In addition to your text message, these dialogs have configurable OK and Cancel buttons. These return
different values to the invocation function, which you use to decide on the action to be taken. Again,
there is a "Don’t show again" version.
These dialogs are extensible; you can define an optional third button, or a small UI section that you
define using
LrView
; see
“Creating custom dialog boxes” on page 84
.
X
Errors
You can display a simple error message with a single OK button, or you can wrap an error dialog
around a function context, so that if the wrapped function throws an error, the dialog appears. See
“Using function contexts for error handling” on page 18
.
X
Platform Open File and Save File
You can bring up the platform-defined file-selection dialogs, so that the user can choose a file system
location.
Creating custom dialog boxes
You can use the
LrDialogs.presentModalDialog()
function to create a completely customized dialog
box, which you can, for example, invoke from a menu item that your plug-in adds to the Lightroom menu
bar, using one of the menu service items:
LrExportMenuItems
,
LrLibraryMenuItems
, or
LrHelpMenuItems
.
Most of the contents of this dialog are defined by an
LrView
hierarchy that you define. To build the
contents of a custom dialog, obtain a factory object using the
LrView
namespace function
LrView.osFactory()
. Like the confirmation dialogs, this dialog automatically contains configurable OK
and Cancel buttons.
You can choose to make this dialog user-resizeable, and can also choose to save its most recent frame size
as one of your plug-in settings. The location of the dialog is also saved, if the user moves it.
The example code in
“Building a basic dialog” on page 110
demonstrates how to build and invoke a
custom dialog within a function context.
User interface elements
This section provides details of the types of container and control nodes you can create with an
LrView
factory object.
Containers
When creating a dialog or a section for the Plug-in Manager or Export dialog, you generally begin with a
top-level container, then, within that container, create its children. Depending on the complexity of your
interface, the children can be nested containers (such as a tabbed view that contains tabbed pages),
placement containers (rows and columns), or the visible controls (such as text and buttons).
X
All containers have the shared view properties listed in
“General view properties” on page 91
, except
as mentioned.
X
All containers except
spacer
have the layout properties listed in
“Determining layout” on page 107
.