Code: Select all
@REQUIRE "RapaGUI"
moai.CreateApp([[<?xml version="1.0" encoding="utf-8"?>
<application id="app">
<window title="ListviewStack" height="Screen:60" width="Screen:60">
<vgroup>
<vgroup frame="true" id="ListTankstellen" title="Tankstellenliste" weight="900">
<listview id="lvTankstellen" notify="doubleclick;ClickColumn;TitleClick;SortColumn" alternate="true">
<column title="Marke"/>
<column title="offen" checkbox="true"/>
<column title="Adresse"/>
<column title="Preis" sortable="true" notify="sortorder" id="lvTankstellenPreis"/>
<column title="Entfernung" sortable="true" notify="sortorder" id="lvTankstellenEntf"/>
</listview>
</vgroup>
<vgroup frame="true" id="ListTankstellenHidden" weight="900">
<listview id="lvTankstellenHidden">
<column title="Marke"/>
<column title="offen" checkbox="true"/>
<column title="Adresse"/>
<column title="Preis" sortable="true" id="lvTankstellenHiddenPreis"/>
<column title="Entfernung" sortable="true" id="lvTankstellenHiddenEntf"/>
<column title="lat" />
<column title="long" />
</listview>
</vgroup>
</vgroup>
</window>
</application>
]])
Function p_EventFunc(msg)
Switch msg.action
Case "RapaGUI":
Switch msg.id
Case "lvTankstellen":
p_HandleListview(msg)
EndSwitch
EndSwitch
EndFunction
Function p_PrepareData()
moai.DoMethod("lvTankstellen", "Clear")
moai.DoMethod("lvTankstellenHidden", "Clear")
moai.Set("ListTankstellen","Hide",False)
For Local i = 0 To 3
moai.DoMethod("lvTankstellen", "Insert",i,i,i,i, i, i)
moai.DoMethod("lvTankstellenHidden", "Insert",i,i,i,i, i, i,i,i)
Next
moai.DoMethod("lvTankstellen", "Sort")
moai.DoMethod("lvTankstellenHidden", "Sort")
EndFunction
function p_HandleListview(msg)
DebugPrint("p_HandleListview()")
DebugPrint("****")
ForEach(msg, DebugPrint)
DebugPrint("****")
If(HaveItem(msg,"attribute"))
If(msg.attribute = "TitleClick")
DebugPrint("Column: ", moai.get("lvTankstellen","SortColumn"))
DebugPrint("Triggervalue: ", msg.triggervalue)
If(msg.triggervalue = 3)
moai.set("lvTankstellen","SortColumn",3)
moai.set("lvTankstellenHidden","SortColumn",3)
ElseIf(msg.triggervalue = 4)
moai.set("lvTankstellen","SortColumn",4)
moai.set("lvTankstellenHidden","SortColumn",4)
EndIf()
DebugPrint("Column1: ",moai.get("lvTankstellen","SortColumn"))
DebugPrint("ColumnH: ",moai.get("lvTankstellenHidden","SortColumn"))
DebugPrint("Order: ",moai.get("lvTankstellenPreis","SortOrder"))
DebugPrint("Order: ",moai.get("lvTankstellenHiddenPreis","SortOrder"))
DebugPrint("OrderE: ",moai.get("lvTankstellenEntf","SortOrder"))
DebugPrint("OrderE: ",moai.get("lvTankstellenHiddenEntf","SortOrder"))
moai.DoMethod("lvTankstellen", "Sort")
moai.DoMethod("lvTankstellenHidden", "Sort")
ElseIf(msg.attribute = "DoubleClick")
p_ViewGasStationDetails()
ElseIf(msg.attribute = "SortColumn")
If(msg.triggervalue = 3)
moai.set("lvTankstellen","SortColumn",3)
moai.set("lvTankstellenHidden","SortColumn",3)
ElseIf(msg.triggervalue = 4)
moai.set("lvTankstellen","SortColumn",4)
moai.set("lvTankstellenHidden","SortColumn",4)
EndIf()
Else()
DebugPrint("!!!")
EndIf()
EndIf()
DebugPrint("************")
EndFunction
InstallEventHandler({RapaGUI = p_EventFunc})
p_PrepareData()
Repeat
WaitEvent
Forever