Page 1 of 2

Treeview active is one place off

Posted: Wed Sep 21, 2022 9:04 pm
by emeck
Hello,

I tried different ways but always get the same result. Here is a simple case.

XML file:

Code: Select all

<?xml version="1.0" encoding="iso-8859-1"?>
<application id="test">
    <window title="Treeview">
        <hgroup>
            <treeview id="tv_test" weight="35" notify="active">
                <column/>
                <node id="nd1" name="node1"></node>
                <node id="nd2" name="node2"></node>
                <node id="nd3" name="node3"></node>
            </treeview>
        </hgroup>
    </window>
</application>
HW script:

Code: Select all

@REQUIRE "RapaGUI"

Function p_EventHandler(msg)
    Switch msg.Class
    Case "Treeview":
        Switch msg.Attribute
        Case "Active":
            DebugPrint(moai.Get("tv_test", "active"))
        EndSwitch
    EndSwitch
EndFunction

InstallEventHandler({RapaGUI = p_EventHandler})
moai.CreateApp(FileToString("test.xml"))

Repeat
    WaitEvent
Forever
If I clicking on node1, then node2, then node3, then node1 and finally node2 prints:

Off
nd1
nd2
nd3
nd1

What am I missing?

Re: Treeview active is one place off

Posted: Thu Sep 22, 2022 12:31 pm
by SamuraiCrow
What were you expecting? It seems to be giving the old value for current rather than the new value. Is that the problem?

Re: Treeview active is one place off

Posted: Thu Sep 22, 2022 5:28 pm
by emeck
SamuraiCrow wrote: Thu Sep 22, 2022 12:31 pm What were you expecting? It seems to be giving the old value for current rather than the new value. Is that the problem?
Isn't it supposed to give the new value? I want to click on a node and get the new current value to do something depending on what is active now, not previously.

Re: Treeview active is one place off

Posted: Thu Sep 22, 2022 8:40 pm
by emeck
@SamuraiCrow

If instead of a Treeview I use a Listview with 3 entries for example, clicking the firts item returns "0", the third returns "2" and the second returns "1", which means retuns the current active item, no the previous. I expected that from the Treeview.

Re: Treeview active is one place off

Posted: Fri Sep 23, 2022 8:44 am
by jPV
Yeah, looks like a bug with Treeview. It's pretty useless to get the previous value, and even msg.TriggerValue gives the prev value instead of the current selection.

Re: Treeview active is one place off

Posted: Sat Sep 24, 2022 11:36 pm
by airsoftsoftwair
What system is this on? Windows? MUI? macOS? Linux? Remember that RapaGUI uses lots of different backends so it's essential to mention the test platform.

Re: Treeview active is one place off

Posted: Sat Sep 24, 2022 11:40 pm
by emeck
@airsoftsoftwair

This in on MorphOS 3.17

Re: Treeview active is one place off

Posted: Sun Sep 25, 2022 12:37 am
by emeck
@airsoftsoftwair

Just tried under Linux x86 and it works as expected. The active node is the currently selected.

Re: Treeview active is one place off

Posted: Sun Sep 25, 2022 7:18 pm
by airsoftsoftwair
emeck wrote: Sat Sep 24, 2022 11:40 pm This in on MorphOS 3.17
Ok, so the MUI backend is affected. But even that is very different between MorphOS and OS3/OS4. Can you test it on OS3 or OS4 with the latest MUI and see if it has the same problem? Might be a MorphOS MUI bug after all.

Re: Treeview active is one place off

Posted: Sun Sep 25, 2022 8:11 pm
by emeck
airsoftsoftwair wrote: Sun Sep 25, 2022 7:18 pm Ok, so the MUI backend is affected. But even that is very different between MorphOS and OS3/OS4. Can you test it on OS3 or OS4 with the latest MUI and see if it has the same problem? Might be a MorphOS MUI bug after all.
Sorry, no working OS3 or OS4 system at the moment, maybe some other can test it?

But I have done the same with MUIRoyale and it works here.

test_mui.xml:

Code: Select all

<?xml version="1.0" encoding="iso-8859-1"?>
<application id="app_test" base="APPTEST">
    <window id="win_test" title="Listtree" muiid="MAIN" notify="closerequest">
        <hgroup>
            <listtree id="lt_test" notify="active">
                <node id="nd1" name="node1"></node>
                <node id="nd2" name="node2"></node>
                <node id="nd3" name="node3"></node>
            </listtree>
        </hgroup>
    </window>
</application>
test_mui.hws:

Code: Select all

<?xml version="1.0" encoding="iso-8859-1"?>
<application id="app_test" base="APPTEST">
    <window id="win_test" title="Listtree" muiid="MAIN" notify="closerequest">
        <hgroup>
            <listtree id="lt_test" notify="active">
                <node id="nd1" name="node1"></node>
                <node id="nd2" name="node2"></node>
                <node id="nd3" name="node3"></node>
            </listtree>
        </hgroup>
    </window>
</application>