Page 1 of 1

Listview select method

Posted: Sun Nov 02, 2014 8:45 am
by lazi
If Listview.Select method is called, the selected item will be visible selected by a pale colour. Then when I select an other item that one still looks like somehow selected. The picture says them all.

So if it is a feature, I have to call manually a Listview.Select --> "Off", each time the user selects an item. It would be a bit inconvinient.

Image

Here is the code snippet:

Code: Select all

mainwindow=[[
<?xml version="1.0" encoding="iso-8859-1"?>
<application id="sqliteman" base="SQLite Manager">
    <window id="win" title="SQLite Manager" muiid="MAIN" notify="closerequest; mouseobject">
	<vgroup>
         <listview id="fields" notify="doubleclick">
                   <column preparse="\33l" bar="true" title="Name"/>
                   <column preparse="\33l" bar="true" title="Type"/>
                </listview>
	  </vgroup>
  </window>
</application>
]]

mui.CreateGui(mainwindow)

mui.DoMethod("fields","Insert","Bottom","Amiga 1000","68000")
mui.DoMethod("fields","Insert","Bottom","Amiga 3000","68030")
mui.DoMethod("fields","Insert","Bottom","Amiga 2000","68000")
mui.DoMethod("fields","Insert","Bottom","Amiga 1200","68020")

mui.domethod("fields","Select",1,"On")

repeat
    WaitEvent
forever

Re: Listview select method

Posted: Sun Nov 02, 2014 4:25 pm
by xz79
Does the following code line help/change anything?

Code: Select all

<listview id="fields" notify="doubleclick"  MultiSelect="None">

Re: Listview select method

Posted: Sun Nov 02, 2014 6:48 pm
by lazi
Not exactly.

Re: Listview select method

Posted: Mon Nov 03, 2014 11:41 pm
by airsoftsoftwair
Hmm, the MUI documentation for Listview.Select() is pretty short but AFAIR this method was designed for multi-select listviews only, though I could be wrong here. Is there any reason why you can't use Listview.Active() to select an entry? That's the usual way to select entries, i.e.

Code: Select all

mui.Set("obj", "active", 1)
See here: http://www.hollywood-mal.com/docs/html/ ... ctive.html

Re: Listview select method

Posted: Tue Nov 04, 2014 8:14 am
by lazi
Thanks, that was it.

I wanted to highlight the default selected item.

Re-reading the guide is certainly a good option if something fails. :)

Re: Listview select method

Posted: Thu Aug 03, 2017 6:12 pm
by GMKai
I have the very same target,
highlight a given entry of a listview,
while setting "active" was the solution, and even works here with the short example of "Appwindow", in my big project I can only activate an entry with the mouse.
But I want to set an entry to "active" programatically before, which fails.
I iterate over the list and get to the desired entry and execute this:

Code: Select all

For Local n = 0 To mui.get("lvstatsleague","Entries")-1
        DebugPrint("N: "..n)
        Local currentid = mui.DoMethod("lvstatsleague", "GetEntry", n)
        If(ToNumber(currentid) = self.leagueid)
           mui.set("lvstatsleague", "active",n)
           Break()
        EndIf()
Next
I don't get an error, and (un)setting the listview as "MultiSelect" didn't change anything.
Does anyone have an idea where to look at?

Re: Listview select method

Posted: Sun Aug 06, 2017 11:24 am
by airsoftsoftwair
Did you check whether this line is actually executed?

Code: Select all

mui.set("lvstatsleague", "active",n)

Re: Listview select method

Posted: Wed Aug 09, 2017 3:17 pm
by GMKai
The line is called and an event is triggered,
stupid me consumes that event.
Will have to write my own function to highlight the entry within that consumer and take care of this.

Currently I see some events coming in with

Code: Select all

(msg.TriggerValue = -1)
I will let you know if I need further help

Re: Listview select method

Posted: Sat Sep 16, 2017 6:16 pm
by GMKai
Here is the next round:

My listview is defined like this:

Code: Select all

<listview id="lvstatsmatchday" input="true" notify="active" MultiSelect="None" autovisible="true" frame="InputList" cyclechain="1">
Shouldn't autovisible make the currently selected/active entry to be displayed in the visible part of the listview?
Do I have to set/trigger something else to get it like that?

Re: Listview select method

Posted: Thu Sep 21, 2017 6:33 pm
by airsoftsoftwair
Yes, it should do that. Please post a little demo code that shows the problem. Just a line from the XML doesn't help here.