2

all: In the DM manual, I saw there are two ways to define layout, DLGTableLayOut(2, 1, 0) and DLGLayout(DLGCreateTableLayout(2, 1, 0)). I tried them, and seems the same. Is there any difference?

Regards

Chen ZX

BmyGuest
  • 6,331
  • 1
  • 21
  • 35
ChenZX
  • 293
  • 4
  • 1
    General info on DM-script dialogs: They are clumsy and you likely *will* experience some frustration with things not working exactly as you want. While one can generate some decent output with enough effort, my advice would be: Keep the UI simple and functional. Also: You likely will encounter commands or attributes that seemingly do *nothing*. This is because a lot of the script code evolved over decades with GMS UI changing a couple of times underneath and not all functionality being kept. – BmyGuest Aug 22 '23 at 07:08

1 Answers1

2

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)

BmyGuest
  • 6,331
  • 1
  • 21
  • 35