Code: Select all
?xml version="1.0" encoding="iso-8859-1"?>
<application base="Listtree" id="application" singletask="true">
<window id="MAIN" muiid="MAIN" width="screen:50" height="screen:70" notify="closerequest" open="false" title="Listtree" closegadget="true" sizegadget="true">
<vgroup>
<register>
<hgroup title="\33A[21] Layout">
<vgroup>
<hgroup>
<vgroup frame="group" frametitle="Layout & Structure" background="groupback">
<listtree id="layout" notify="active;doubleclick" cyclechain="1">
<node id="vgroup-0" name="\33P[FF0000] Default Application Window (VGROUP) \33A[100] " open="true">
<node id="hgroup-6" name="\33P[FF0000] HGroup 6 Window (HGROUP) \33A[72]" open="true">
<item id="hgroup6-scale">\33A[131] Scale \33u\33P[888888](Scale)</item>
<item id="hgroup6-checkmark1">\33A[56] Checkmark \33u\33P[888888](Checkmark)\33n : \33P[00FF00]SELECTED</item>
</node>
</node>
</listtree>
<hgroup>
<button id="layout-foldall" notify="pressed" hichar="e">\33A[28] Fold All</button>
<button id="layout-unfoldall" notify="pressed" hichar="c">\33A[29] Unfold All</button>
<button id="layout-remove-gadget" notify="pressed" hichar="r">\33A[4] Remove selected</button>
</hgroup>
</vgroup>
</hgroup>
</vgroup>
</hgroup>
</register>
</vgroup>
</window>
</application>
Code: Select all
Const #AISSFOLDER = "tbimages:"
Const #REMOVE = 4
Const #LAYOUT = 21
Const #TREEFOLDALL = 28
Const #TREEUNFOLDALL = 29
Const #CHECKMARK = 56
Const #GAUGE = 66
Const #HGROUP = 72
Const #VGROUP = 100
Const #SCALE = 131
Global application, base
application = {}
base = {}
application.name = "Listtree"
@APPTITLE "Listree"
@APPAUTHOR "Richard Lake"
@APPCOPYRIGHT "Richard Lake"
@APPVERSION "$VER: Listtree 0.1 (24-Dec-14)"
@APPDESCRIPTION "A description"
;; base:LoadBrush(constant, folder$, alpha)
Function base:LoadBrush(constant, folder$, alpha)
ExitOnError(False)
If alpha = True
LoadBrush(constant, folder$, {LoadAlpha = TRUE})
Else
LoadBrush(constant, folder$, {LoadAlpha = FALSE})
EndIf
If GetLastError() > 0 and FindStr(folder$, #AISSFOLDER) > -1
SystemRequest("General File/Access error","There has been a problem opening an image during run time and now " .. application.name .. " is unstable.\n\nSorry, you must restart " .. application.name .. "\n\nCannot find:\n\n" .. folder$,"Exit Application",#REQICON_WARNING)
End()
EndIf
ExitOnError(True)
EndFunction
Function event_handler(msg)
debugprint(msg.class)
debugprint(msg.id)
debugprint(msg.attribute)
Switch msg.class
;; Window
Case "Window"
Switch msg.id
Case "MAIN"
End()
EndSwitch
;; ListTree
Case "Listtree"
Switch msg.attribute
Case "Active"
Switch msg.id
Case "layout"
Local found, table = mui.DoMethod("layout", "getentry", "active", "active", "")
debugprint(table.name)
EndSwitch
EndSwitch
EndSwitch
EndFunction
base:LoadBrush(#REMOVE, #AISSFOLDER .. "remove", True)
base:LoadBrush(#CHECKMARK, #AISSFOLDER .. "gadget_checkbox", True)
base:LoadBrush(#HGROUP, #AISSFOLDER .. "gadget_layout_horizontal", True)
base:LoadBrush(#VGROUP, #AISSFOLDER .. "gadget_layout_vertical", True)
base:LoadBrush(#SCALE, #AISSFOLDER .. "resize", True)
base:LoadBrush(#LAYOUT, #AISSFOLDER .. "screen", True)
base:LoadBrush(#TREEFOLDALL, #AISSFOLDER .. "treefold", True)
base:LoadBrush(#TREEUNFOLDALL, #AISSFOLDER .. "treeunfold", True)
mui.CreateGUI( FileToString("gui.xml"))
Local object
object = {}
object.class = "Gauge"
object.icon = #GAUGE
object.id = "vgroup0-gauge1"
object.name = "Progress"
object.ckey = "p"
object.orientation = 0
object.min = "0"
object.max = "100"
object.current = 0
object.infotext = "%ld %% completed..."
object.scale = 0
object.disabled = False
object.hidden = False
InstallEventHandler({MUIRoyale = event_handler })
@DISPLAY {Width = 800, Height = 600, Borderless = False, Hidden = true, Title = "", Active = True, nomodeswitch=true, nohide=true}
mui.Set("MAIN","open",True)
ExitOnError(False)
debugprint("layout","insert","\27A[" .. object.icon .. "] " .. object.name .." \27u\27P[888888](" .. object.class .. ")\27n : \27P[00FF00] (SCALE)",object.id,"vgroup-0",mui.Get("layout","active"),"active;open")
mui.DoMethod("layout","insert","\27A[" .. object.icon .. "] " .. object.name .." \27u\27P[888888](" .. object.class .. ")\27n : \27P[00FF00] (SCALE)",object.id,"vgroup-0",mui.Get("layout","active"),"active;open")
mui.Set(object.id,"userdata",object)
Local result = mui.Get(object.id,"userdata")
debugprint( "addgauge userdata = " .. result.class )
Repeat
WaitEvent()
Forever
1. Button row in HGROUP, sometimes MUI Royale misses out the loading of images into buttons. Very strange. I sometimes notice this in Jack as well.
2. Although in this example \27A[66] my listree row has an image to the left of object.name strange in my original code it does not! However, code-wise nothing changes. The brush 66 is correct.
3. mui.Set(object.id,"userdata") - Now this the line of code I am desperate to get working, but as you can see in this example it just fails returning 'Off' instead of the value sent earlier through DoMethod.
-----
http://www.lakemarketing.co.uk/jack/listree.lha - Download link
Hope you can solve this for me =) Merry christmas