This is the goal output which I am trying to achieve.
Code: Select all
<hgroup>
<button>Button 1</button>
<text>This is some text</text>
</hgroup>
Code: Select all
<hgroup>
<button>Button 1</button>
<text>This is some text</text>
</hgroup>
Code: Select all
Fruit
Apple
Bramley
Crab
Orange
Satsuma
Tangerine
Pears
Vegetables
Carrots
Peas
Turnips
Code: Select all
Function Application:DumpLayoutTree(id$, node,window)
Local found, t = mui.DoMethod(id$, "GetEntry", node, "Head", "")
iteration = iteration + 1
While found = True
Local userdata = mui.Get(t.id,"userdata")
Project.Application.Win.Layout[window][iteration] = userdata
debugprint( "Project.Application.Win.Layout[" .. window .. "][" .. iteration .. "].id = " .. Project.Application.Win.Layout[window][iteration].id )
debugprint( "Project.Application.Win.Layout[" .. window .. "][" .. iteration .. "].class = " .. Project.Application.Win.Layout[window][iteration].class )
If t.Node = True
Application:DumpLayoutTree(id$, t.muiid, window)
Else
iteration = iteration + 1
EndIf
found, t = mui.DoMethod(id$, "GetEntry", t.muiid, "Next", "")
Wend
EndFunction
Code: Select all
...
<WINDOW ID="MAIN" MENUSTRIP="" MuiID="MAIN" Width="Screen:100" Height=":100" Notify="Activate;CloseRequest;MouseObject" open="true" Title="Default Application Window" Borderless="false" CloseGadget="true" DepthGadget="true" SizeGadget="true" AppWindow="false" >
<VGROUP ID="win0-vgroup0" Frame="group" FrameTitle="frame-title" Background="Groupback">
<REGISTER ID=" win0-register0" Notify="ActivePage" >
<VGROUP ID="win0-vgroup1" Frame="group" FrameTitle="frame-title" Background="Groupback">
<LISTVIEW ID=" win0-vgroup1-listview-0" Weight="100" Notify="ClickColumn;DoubleClick;" AdjustWidth="true" AdjustHeight="true" AutoVisible="true" MultiSelect="default" MinLineHeight="20" ScrollerPos="right" CycleChain="true">
<Column Title="Name">
<Item>Richard Lake</Item>
<Item>Laura Campbell</Item>
</Column>
<Column Title="Age">
<Item>38</Item>
<Item>29</Item>
</Column>
</LISTVIEW>
<HGROUP ID="win0-hgroup0" Frame="group" FrameTitle="frame-title" Background="Groupback">
<LABEL ID="win0-colour-0" ControlChar="l" Hidden="true" Centered="true" DoubleFrame="true" LeftAligned="true" Font="Normal" >Select a Label</LABEL>
<COLORADJUST ID="win0-colour-1" ShortHelp="shorthelp-coloradjust" HelpNode="coloradjust-node" Weight="100" Disabled="true" Hidden="true" Notify="Rgb" Rgb="$FF00FF" />
<VGROUP ID="win0-vgroup2" Frame="group" FrameTitle="frame-title" Background="Groupback">
<RADIO ID=" win0-othertab-0" Weight="100" Active="2" CycleChain="true">
<Item>Red</Item>
<Item>Green</Item>
<Item>Blue</Item>
</RADIO>
<HOLLYWOOD ID="win0-othertab-1" Weight="100" MinWidth="100" MaxWidth="1000" MinHeight="100" MaxHeight="1000" />
<HGROUP ID="win0-hgroup1" Frame="group" FrameTitle="frame-title" Background="Groupback">
<BUTTON ID="win0-hgroup1-button1" ShortHelp="shorthelp-text" HelpNode="button-node" Weight="100" ControlChar="b" Disabled="true" Hidden="true" Label="Action" HiChar="b" Notify="Pressed;Selected" Toggle="true" />
<TEXT ID="win0-hgroup1-text4" Hidden="true" HiChar="t" Preparse="preparse-text" >This is some text</TEXT>
<HGROUP ID="win0-hgroup2" Frame="group" FrameTitle="frame-title" Background="Groupback">
<STRING ID="win0-hgroup2-string1" ShortHelp="shorthelp-string" HelpNode="string-node" Weight="100" ControlChar="s" Disabled="true" Hidden="true" Notify="Acknowledge;Contents" Contents="this is a string" Maxlen="80" Accept="accept" Reject="reject" Secret="true" AdvanceOnCR="true" />
<POPLIST ID=" win0-hgroup2-poplist1" Weight="100" Notify="Acknowledge;Contents" Contents="Apple" CycleChain="true">
<Item>Apple</Item>
</POPLIST>
<POPDRAWER ID="win0-hgroup2-popdrawer1" ShortHelp="shorthelp-popdrawer" HelpNode="popdrawer-node" Weight="100" ControlChar="d" Disabled="true" Hidden="true" Notify="Acknowledge;Contents" Title="PopDrawer" Contents="PROGDIR:" SaveMode="true" />
<POPFILE ID="win0-hgroup2-popfile1" ShortHelp="shorthelp-popfile" HelpNode="popfile-node" Weight="100" ControlChar="f" Disabled="true" Hidden="true" Notify="Acknowledge;Contents" Contents="defaultvalue" RejectPattern="#?.accepted" RejectPattern="#?.test" SaveMode="true" RejectIcons="true" ShowPattern="true" />
<HGROUP ID="win0-hgroup3" Frame="group" FrameTitle="frame-title" Background="Groupback">
<TEXTEDITOR ID="win0-hgroup3-texteditor1" ShortHelp="shorthelp-texteditor" HelpNode="texteditor-node" Weight="100" ControlChar="t" Disabled="true" Hidden="true" Notify="AreaMarked;CursorX;CursorY;HasChanged;Pen;RedoAvailable;StyleBold;StyleItalic;StyleUnderline;UndoAvailable" Contents="This is some text" Columns="80" Rows="40" FixedFont="true" ReadOnly="true" ScrollBars="true" FixedFont="hardwrap" WrapWords="true" ConvertTabs="true" />
<POPPEN ID="win0-hgroup3-poppen1" ShortHelp="shorthelp-poppen" HelpNode="poppen-node" Weight="100" Disabled="true" Hidden="true" Notify="Rgb" Title="Select a Pen" Rgb="$FF00FF" />
<HGROUP ID="win0-hgroup4" Frame="group" FrameTitle="frame-title" Background="Groupback">
<VGROUP ID="win0-vgroup3" Frame="group" FrameTitle="frame-title" Background="Groupback">
<SLIDER ID="win0-vgroup3-slider1" ShortHelp="shorthelp-slider" HelpNode="slider-node" Weight="100" ControlChar="s" Disabled="true" Hidden="true" Horiz="true" Level="65" Min="50" Max="75" Format="%ld" Quiet="true" Reverse="true" Notify="Stringify" Stringify="MyFunction" />
<IMAGE ID="win0-vgroup3-image1" ShortHelp="shorthelp-image" HelpNode="image-node" Weight="100" Source="brush:100" />
<HGROUP ID="win0-hgroup5" Frame="group" FrameTitle="frame-title" Background="Groupback">
<CYCLE ID=" win0-hgroup5-cycle1" Weight="100" Notify="Active" Active="0" CycleChain="true">
<Item>Red</Item>
<Item>Yellow</Item>
<Item>Pink</Item>
<Item>Green</Item>
</CYCLE>
<HGROUP ID="win0-hgroup6" Frame="group" FrameTitle="frame-title" Background="Groupback">
<FLOATTEXT ID="win0-hgroup6-floattext1" Hidden="true" Justify="true" Font="Normal" >This is some floattext</FLOATTEXT>
<POPFONT ID="win0-hgroup6-popfont1" Weight="100" ControlChar="f" Disabled="true" Hidden="true" Notify="Acknowledge;Contents" Title="Select a Font..." Contents="topaz/8" MinHeight="5" MaxHeight="32" FixedWidthOnly="true" />
<RECTANGLE ID="win0-hgroup6-rectangle" BarTitle="rectangle-test" Hbar="true" />
<GAUGE ID="win0-hgroup6-gauge" Weight="100" Hidden="true" Notify="Current" Horiz="false" Current="75" Min="50" Max="100" InfoText="%ld %% completed..." />
<Scale/>
<CHECKMARK ID="win0-hgroup6-checkmark1" ShortHelp="shorthelp-text" HelpNode="checkmark-node" Weight="100" Disabled="true" Hidden="true" Notify="Selected" Toggle="true" />
<TOOLBAR ID=" win0-toolbar0" Weight="100" Notify="Active;MouseOver" BarPos="left" Horiz="true" EnableKeys="true" LabelPos="bottom" ViewMode="textgfx" IgnoreAppearance="true" CycleChain="true">
<TOOLBARBUTTON ID="win0-toolbar0-button1" ShortHelp="shorthelp-toolbarbutton" HelpNode="toolbarbutton-node" Disabled="true" Hidden="true" Notify="Pressed;Selected" />
</Toolbar>
<HGROUP ID="win0-hgroup7" Frame="group" FrameTitle="frame-title" Background="Groupback">
<SCROLLGROUP ID=" win0-scrollgroup0" >
<VIRTGROUP ID=" win0-virtgroup0" >
<LISTTREE ID=" win0-virtgroup0-listtree" Weight="100" Disabled="false" ShortHelp="shorthelp-listtree" HelpNode="listtree-node" Notify="Active;DoubleClick" CycleChain="true">
</LISTTREE>
</WINDOW>
...
Code: Select all
printCID(long i, enum CLASSID cid, BOOL end) {
long j;
for(j=1; j <= i; j++) {bug(" "); }
bug("%s%s\n", end ? "/" : "", CLASSIDStr[cid]);
}
...
DEC_QUICK(MM_WinMain_Test)
{
GETDATA;
//struct MP_ *m = (APTR)msg;
Object *lt = data->ltMenu;
structTN *tn = NULL, *hd = NULL, *tnP = NULL, *ln = NULL, *pn = NULL;
struct MenuEntry *entry;
long i=0, j;
Bug("DumpTree\n");
tn = LT_Head(lt, NULL);
while (tn)
{
entry = tn->tn_User;
if (entry) {
printCID(i, entry->cid, FALSE);
if (LT_IsListNode(tn)){
i++;
}
}
tnP = tn; hd = 1;
if (LT_IsListNode(tn) && (hd = LT_Head(lt, tn))){
tn = hd;
}else{
if (!hd){
i--;
printCID(i, entry->cid, TRUE);
}
tn = LT_NextSame(lt, tn);
while (!tn) {
i--;
pn = LT_Parent(lt, tnP);
if (pn){
entry = pn->tn_User;
printCID(i, entry->cid, TRUE);
tn = LT_NextSame(lt, pn); tnP = pn;
}else{
break;
}
}
}
if (!tn) {
while( (pn = LT_Parent(lt, tnP)) && !(tn = LT_NextSame(lt, pn)) )
{ tnP = pn; };
}
}// while
return 0;
}
Code: Select all
Application
Window
Button
Checkmark
Gauge
HGroup
HGroup
Cycle
HGroup
HGroup
Listtree
Image
/Listtree
/HGroup
/HGroup
/HGroup
Coloradjust
/HGroup
/Window
Window
/Window
/Application