Listview select method

Discuss GUI programming with the MUI Royale plugin here
Post Reply
User avatar
lazi
Posts: 625
Joined: Thu Feb 24, 2011 11:08 pm

Listview select method

Post 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
xz79
Posts: 18
Joined: Thu Mar 14, 2013 10:12 am

Re: Listview select method

Post by xz79 »

Does the following code line help/change anything?

Code: Select all

<listview id="fields" notify="doubleclick"  MultiSelect="None">
User avatar
lazi
Posts: 625
Joined: Thu Feb 24, 2011 11:08 pm

Re: Listview select method

Post by lazi »

Not exactly.
User avatar
airsoftsoftwair
Posts: 5443
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Listview select method

Post 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
User avatar
lazi
Posts: 625
Joined: Thu Feb 24, 2011 11:08 pm

Re: Listview select method

Post 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. :)
GMKai
Posts: 140
Joined: Mon Feb 15, 2010 10:58 am

Re: Listview select method

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

Re: Listview select method

Post by airsoftsoftwair »

Did you check whether this line is actually executed?

Code: Select all

mui.set("lvstatsleague", "active",n)
GMKai
Posts: 140
Joined: Mon Feb 15, 2010 10:58 am

Re: Listview select method

Post 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
GMKai
Posts: 140
Joined: Mon Feb 15, 2010 10:58 am

Re: Listview select method

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

Re: Listview select method

Post 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.
Post Reply