Treeview active is one place off

Discuss GUI programming with the RapaGUI plugin here
User avatar
emeck
Posts: 169
Joined: Fri Apr 03, 2015 3:17 pm

Treeview active is one place off

Post 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?
PowerBook 5.2 MorphOS 3.15
PowerBook 5.8 MorphOS 3.15
Amiga 1200 BPPC/BVision AOS4.1 FE
SamuraiCrow
Posts: 475
Joined: Fri May 15, 2015 5:15 pm
Location: Waterville, Minnesota USA

Re: Treeview active is one place off

Post 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?
I'm on registered MorphOS using FlowStudio.
User avatar
emeck
Posts: 169
Joined: Fri Apr 03, 2015 3:17 pm

Re: Treeview active is one place off

Post 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.
PowerBook 5.2 MorphOS 3.15
PowerBook 5.8 MorphOS 3.15
Amiga 1200 BPPC/BVision AOS4.1 FE
User avatar
emeck
Posts: 169
Joined: Fri Apr 03, 2015 3:17 pm

Re: Treeview active is one place off

Post 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.
PowerBook 5.2 MorphOS 3.15
PowerBook 5.8 MorphOS 3.15
Amiga 1200 BPPC/BVision AOS4.1 FE
User avatar
jPV
Posts: 603
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: Treeview active is one place off

Post 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.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Treeview active is one place off

Post 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.
User avatar
emeck
Posts: 169
Joined: Fri Apr 03, 2015 3:17 pm

Re: Treeview active is one place off

Post by emeck »

@airsoftsoftwair

This in on MorphOS 3.17
PowerBook 5.2 MorphOS 3.15
PowerBook 5.8 MorphOS 3.15
Amiga 1200 BPPC/BVision AOS4.1 FE
User avatar
emeck
Posts: 169
Joined: Fri Apr 03, 2015 3:17 pm

Re: Treeview active is one place off

Post by emeck »

@airsoftsoftwair

Just tried under Linux x86 and it works as expected. The active node is the currently selected.
PowerBook 5.2 MorphOS 3.15
PowerBook 5.8 MorphOS 3.15
Amiga 1200 BPPC/BVision AOS4.1 FE
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Treeview active is one place off

Post 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.
User avatar
emeck
Posts: 169
Joined: Fri Apr 03, 2015 3:17 pm

Re: Treeview active is one place off

Post 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>
PowerBook 5.2 MorphOS 3.15
PowerBook 5.8 MorphOS 3.15
Amiga 1200 BPPC/BVision AOS4.1 FE
Post Reply