Listview select method

Discuss GUI programming with the MUI Royale plugin here

Listview select method

Postby lazi » Sun Nov 02, 2014 9:45 am

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
User avatar
lazi
 
Posts: 273
Joined: Fri Feb 25, 2011 12:08 am

Re: Listview select method

Postby xz79 » Sun Nov 02, 2014 5:25 pm

Does the following code line help/change anything?

Code: Select all
<listview id="fields" notify="doubleclick"  MultiSelect="None">
xz79
 
Posts: 18
Joined: Thu Mar 14, 2013 11:12 am

Re: Listview select method

Postby lazi » Sun Nov 02, 2014 7:48 pm

Not exactly.
User avatar
lazi
 
Posts: 273
Joined: Fri Feb 25, 2011 12:08 am

Re: Listview select method

Postby airsoftsoftwair » Tue Nov 04, 2014 12:41 am

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
airsoftsoftwair
 
Posts: 2283
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

Re: Listview select method

Postby lazi » Tue Nov 04, 2014 9:14 am

Thanks, that was it.

I wanted to highlight the default selected item.

Re-reading the guide is certainly a good option if something fails. :)
User avatar
lazi
 
Posts: 273
Joined: Fri Feb 25, 2011 12:08 am

Re: Listview select method

Postby GMKai » Thu Aug 03, 2017 6:12 pm

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?
GMKai
 
Posts: 60
Joined: Mon Feb 15, 2010 11:58 am

Re: Listview select method

Postby airsoftsoftwair » Sun Aug 06, 2017 11:24 am

Did you check whether this line is actually executed?

Code: Select all
mui.set("lvstatsleague", "active",n)
User avatar
airsoftsoftwair
 
Posts: 2283
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

Re: Listview select method

Postby GMKai » Wed Aug 09, 2017 3:17 pm

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: 60
Joined: Mon Feb 15, 2010 11:58 am

Re: Listview select method

Postby GMKai » Sat Sep 16, 2017 6:16 pm

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?
GMKai
 
Posts: 60
Joined: Mon Feb 15, 2010 11:58 am

Re: Listview select method

Postby airsoftsoftwair » Thu Sep 21, 2017 6:33 pm

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


Return to MUI Royale

Who is online

Users browsing this forum: No registered users and 1 guest

cron