Page 1 of 1

Imagecache on LInux

Posted: Sun Jan 20, 2019 11:19 am
by evil
Hello again!

I Created a gui, which contains one listview. And three sliders.
Inside this listview are some entries, which contain images (brushes, which show just one color...)
The sliders will be used to change the colors of those listviewimages.
When I now change an image of an entry, the new image will be displayed correct on amiga.

Doing the same on linux will cause some other entries to change their images, too.
Could not test on Win/Mac....

Its difficult to discribe the problem, so here is a (not that) small code snippet:

Code: Select all

@REQUIRE "RapaGUI"
xml$=[[<?xml version="1.0" encoding="iso-8859-1"?>
    <application id="app">
        <window>
            <hgroup>
                <listview id="lv" notify="active">
                    <column icon="1"> </column>
                </listview>
                <slider id="red" horiz="0" notify="level" max="255" reverse="1"/>
                <slider id="green" horiz="0" notify="level" max="255" reverse="1"/>
                <slider id="blue" horiz="0" notify="level" max="255" reverse="1"/>
                <rectangle/>
            </hgroup>
        </window>
    </application>]]

color={r=0,g=0,b=0}
lvcolor={0,0,0,0,0,0}
Function p_eventfunc(msg)
    Switch msg.class
    Case "Slider"
        color.r=moai.get("red","level")
        color.g=moai.get("green","level")
        color.b=moai.get("blue","level")
        lvcolor[activeentry]=color.r*65536+color.g*256+color.b
            moai.set("lv","quiet","1")
            moai.domethod("lv","remove",activeentry)
            moai.FreeImage(activeentry)
            CreateBrush(activeentry,30,20,lvcolor[activeentry])
            moai.DoMethod("lv","insert",activeentry,activeentry,hexstr(lvcolor[activeentry]))
            moai.set("lv","active",activeentry)
            moai.set("lv","quiet","0")
 
    Case "Listview"
        activeentry=moai.get("lv","active")
        moai.set("red","level",red(lvcolor[activeentry]),"nonotify","1")
        moai.set("green","level",green(lvcolor[activeentry]),"nonotify","1")
        moai.set("blue","level",blue(lvcolor[activeentry]),"nonotify","1")
    EndSwitch
EndFunction

InstallEventHandler({Rapagui=p_eventfunc})

moai.createapp(xml$)

for t=0 to 5
    CreateBrush(t,30,20,#Black)
    moai.DoMethod("lv","insert","bottom",t,0)
Next

activeentry=0 moai.set("lv","active",activeentry)

Repeat
    WaitEvent()
Forever
Do I have a logical problem, or is it a bug??

Best regards

George

Re: Imagecache on LInux

Posted: Sun Jan 20, 2019 11:52 am
by evil
Ok, I think I got it...

Using listview.forcemode with attribute dataview, seems to solve the problem..

Best regards

George

Re: Imagecache on LInux

Posted: Wed Jan 23, 2019 5:31 pm
by airsoftsoftwair
Looks still like a bug, using data view mode is a good workaround then, though :)