user-interfacedialogdm-script

What is the difference between DLGTableLayOut(2, 1, 0) and DLGLayout(DLGCreateTableLayout(2, 1, 0))?


In the DM manual, I noticed two methods for defining a layout:

I experimented with both and found that they appear to produce the same layout. Is there any underlying difference between these two approaches, such as performance, flexibility, or any subtle behavioral distinctions? Any insights or documentation clarifications would be greatly appreciated.


Solution

  • All DLG commands only generated or modify a single TagGroup that describes the dialog. If two commands produces the same TagGroup, they are, indeed, identical. You can best check this using the command TagGroupOpenBrowserWindow() to visualize the tagGroup.

    TagGroup dlg,dlgItems
    // The Command to generate a dialog just generates a structured TagGroup
    // dlgItems just points to the "Items" subgroup of the same TagGroup
    dlg = DLGCreateDialog("Test",dlgItems)
    
    // Show the TagGroup at any step. Using "clone" to have a copy
    // as the original will be further modified below.
    dlg.TagGroupClone().TagGroupOpenBrowserWindow("Just created",0)
    
    // Adding items just adds to the  "Items" TagGroup with correct structure and defaults
    dlg.DLGAddElement( DLGCreateStringField("Text 1") )
    dlg.DLGAddElement( DLGCreateStringField("Text 2", 12) )
    TagGroup textItems
    dlg.DLGAddElement( DLGCreateStringField("Label", textItems, "Text 3", 14) )
    dlg.TagGroupClone().TagGroupOpenBrowserWindow("Added Fields",0)
    
    // Some DLG command affect the overall structure, adding or overwriting tags
    dlg.DLGTableLayout(2,2,1)
    dlg.TagGroupClone().TagGroupOpenBrowserWindow("Added Table Layout",0)
    
    dlg.DLGTableLayout(3,1,0)
    dlg.TagGroupClone().TagGroupOpenBrowserWindow("Modified Table Layout",0)
    
    // You can often do whatever you want - but it will not be "understood" by the code
    // buidling the final dialog object later...
    taggroup layoutTags = NewTagGroup()
    layoutTags.TagGroupSetTagAsString("My own", "I do what I want!")
    dlg.DLGLayout(layoutTags)
    dlg.TagGroupClone().TagGroupOpenBrowserWindow("Setting customs tags (invalid)",0)