This example explains all steps to create and use a new entry dialog.
1.In the appropriate xxx_Config.xml file, locate the ObjectUIs section. 2.Create a new object UI, using a code similar to the below one: <objectUI name="EditArticleNotes" useAttributesOrder="true"> <default mode="Hidden"/> <attribute name="name" > <ui mode="ReadOnly" label="Name:"/> </attribute> <attribute name="notes" > <ui mode="Normal" labelPosition="Side" orientation="Vertical"/> </attribute> </objectUI> There are two attributes (name and notes) that will appear on the entry dialog box. The name name="EditArticleNotes" must be unique in the all the xxx_config files that get loaded in the sequence. The useAttributesOrder="true" is mandatory. Specify mode="Normal" for editable attributes and mode="ReadOnly" for read-only attributes. |
In the appropriate custom add-in file, create a script loader, such as one below. <ShellCommand(CanExecute:="Ena_HasActiveArticle")> _ Public Sub EditArticleNotes() Dim ids(0) As Integer ids(0) = Ted.GetActiveArticle.Id Dim editDialog As EditObjDialog = New EditObjDialog(TedApp.ClientApp().MainWindow) If Not editDialog.SetIds(ids, "EditArticleNotes") Then Exit Sub editDialog.SizeToContent = SizeToContent.WidthAndHeight editDialog.Title = My.Resources.IDS_EditNotes editDialog.MinWidth = 300 editDialog.MinHeight = 250 editDialog.ShowDialog() End Sub Note: the "appropriate file" depends in which conditions the entry dialog should appear. •During text editing in Ted: CustomArticle.vb •During text editing in Ted and Fred: CustomArticle.vb and CustomPage.vb, duplicated also in the CustomPageTxtDesigner class. •In a listing in Ted or Fred: CustomTed.vb •On a page in Fred: CustomPage.vb. Should you want to have it in all the places, then you need to duplicate the same code in CustomTed, CustomArticle, and CustomPage. |
In the appropriate configuration file, assign the script loader to a menu, toolbar or key, with the syntax as below. <l:ShellMenuItem Header="Article notes..." CommandParameter="EditArticleNotes"/> or <l:TBBtn CommandParameter="EditArticleNotes" ToolTip="Article Notes" Icon="%159_display notes_16.png"/> or <KeyBinding CommandType="Script" CommandParameter="EditArticleNotes" Modifiers="Control" Key="Q"/> |