Listview Column Hide

Discuss GUI programming with the RapaGUI plugin here
GMKai
Posts: 158
Joined: Mon Feb 15, 2010 10:58 am

Listview Column Hide

Post by GMKai »

https://forums.hollywood-mal.com/viewtopic.php?t=2207

But here is a new report:

I have a listview defined like this:

Code: Select all

 <vgroup frame="true" id="ListTankstellen" title="Tankstellenliste" weight="900">
                <listview id="lvTankstellen" notify="doubleclick">
                  <column title="ID" hide="true">
                  </column>
                  <column title="Marke">
                  </column>
                  <column title="offen" checkbox="true">
                  </column>
                  <column title="Adresse">
                  </column>
                  <column title="Preis" sortable="true">
                  </column>
                  <column title="Entfernung" sortable="true">
                  </column>
                  <column title="lat" hide="true">
                  </column>
                  <column title="long" hide="true">
                  </column>
                </listview>
          </vgroup>            
That looks good for me, when running under MorphOS.
A user reported the first column to be visible for him.
He is using AmigaOS 3.

Is that a limitation of MUI, or anything I have to set in the script?
User avatar
airsoftsoftwair
Posts: 5594
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Listview Column Hide

Post by airsoftsoftwair »

GMKai wrote: Fri Sep 06, 2024 8:38 am He is using AmigaOS 3. Is that a limitation of MUI, or anything I have to set in the script?
No, that should definitely work on OS3 as well. What exact MUI version is he using on OS3?
User avatar
jPV
Posts: 641
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: Listview Column Hide

Post by jPV »

I think hide doesn't work on MUI 3.8 and earlier. At least I had to skip that with MUIRoyale.. I check MUI version with mui.IsVersion4() and modify the XML definition according to that.
GMKai
Posts: 158
Joined: Mon Feb 15, 2010 10:58 am

Re: Listview Column Hide

Post by GMKai »

airsoftsoftwair wrote: Tue Sep 10, 2024 7:28 pm No, that should definitely work on OS3 as well. What exact MUI version is he using on OS3?
He is using MUI 3.8

I will check if I can skip IDs for all plattforms
GMKai
Posts: 158
Joined: Mon Feb 15, 2010 10:58 am

Re: Listview Column Hide

Post by GMKai »

I try to circumvent with a hidden shadowcopy of the listview.

Defined like this:

Code: Select all

<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> 
For now I can Set the group to be hidden:

Code: Select all

moai.Set("ListTankstellenHidden","Hide",True)
During runtime I try to keep up with changes in sorted entries, which currently runs out of stack:

Code: Select all

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

Any hints on that?
User avatar
airsoftsoftwair
Posts: 5594
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Listview Column Hide

Post by airsoftsoftwair »

Running out of stack is very likely caused by some recursion problems. You have to prepare an MCVE so that the cause can be checked.
GMKai
Posts: 158
Joined: Mon Feb 15, 2010 10:58 am

Re: Listview Column Hide

Post by GMKai »

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

Clicking the sortable columns make the application run out of stack
User avatar
airsoftsoftwair
Posts: 5594
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Listview Column Hide

Post by airsoftsoftwair »

Works here on AmigaOS 3 with the latest MUI. What platform are you on and which MUI version?
GMKai
Posts: 158
Joined: Mon Feb 15, 2010 10:58 am

Re: Listview Column Hide

Post by GMKai »

this was tested with Morphos 3.8
bugfixrelease of rapagui is also installed.

will give it another shot under Windows...
GMKai
Posts: 158
Joined: Mon Feb 15, 2010 10:58 am

Re: Listview Column Hide

Post by GMKai »

works with windows too


will see if i can get it to work in the intended way and check if that changes behaviour under MorphOS
Post Reply