forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

List view (%lv) control does not update view properly

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Fri Sep 02, 2016 11:36 pm    Post subject: List view (%lv) control does not update view properly Reply with quote

I have a list view control (actually several) whose definition looks like this:
Code:

   i = winio@('%^lv[full_row_select,grid_lines,user_font,show_selection_always]&',800,200,
script_data_complete,max_total_script,script_data_complete_sel,1,script_data_select)

I set the appropriate element in script_data_complete_sel to be the item I want to have appear as selected and visible in the list view box. While the item certainly will show that it is selected (if it is not visible, then if one scrolls manually through the items in the list, it can be seen grayed slightly as expected), the control does not auto-scroll to the selected item as the documentation (and show_selection_always) would suggest. I have tried performing window_update@ on the listview data, and on the selection vector, nothing seems to cause the control to show the selected item.

I'm wondering if I'm not window_update@'ing the right items, or ......

Thanks for taking a look!
Back to top
View user's profile Send private message Visit poster's website
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Sat Sep 03, 2016 4:04 pm    Post subject: Reply with quote

Never mind! I found the post from 2009 that discussed this and I see the issues with both my code and the control!
Back to top
View user's profile Send private message Visit poster's website
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Tue Sep 06, 2016 7:26 pm    Post subject: Reply with quote

... which post from 2009 ?

I'd also be ver yinterested if anyone can tell me how to find that post using the first few words of this posts title and the forum 'Search' as I'll be if I can achieve it !!!
Back to top
View user's profile Send private message
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Tue Sep 06, 2016 7:47 pm    Post subject: Reply with quote

Here's the link: http://forums.silverfrost.com/viewtopic.php?t=1389&start=0&postdays=0&postorder=asc&highlight=listview

I did a search on the term "listview".
Back to top
View user's profile Send private message Visit poster's website
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Tue Sep 06, 2016 8:02 pm    Post subject: Reply with quote

If you allow multiple selections, then the selection made will not necessarily show in the display area. I understand why that is: Do you display the first or last one? No real way to do this automatically, only programmatically.

One can select the one you wish by using a simple routine. You'll need to get the handle of the list view control using the %lc command, then call this routine with the handle and the item number (1,2,3,...) to be displayed.



Code:

   subroutine reposition_lv(wind,item)
   use mswin
   integer*4 wind
   integer*4 item,i ! item is 1 based, but the sendmessage requires zero based
   integer*4,parameter:: LVM_ENSUREVISIBLE=z'1000' + 19 ! https://www.winehq.org/pipermail/wine-devel/2002-October/009527.html
   i=sendmessage(wind,LVM_ENSUREVISIBLE,item-1,.false.) ! returns 1 for success, or 0 for failure
   return
   end
Back to top
View user's profile Send private message Visit poster's website
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Wed Sep 07, 2016 1:26 am    Post subject: Reply with quote

what's the z'1000' in the PARAMETER definition ???

it seems that in the 2009 post Paul was ready to modify to make the first of a multi-selection appear (see 2nd comment up from bottom of that post) , but the mod must have got overlooked.
Maybe it could be done now with the option of either putting it at top, middle or bottom (the latter Paul having already deemed as feasible) ?
Back to top
View user's profile Send private message
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Wed Sep 07, 2016 3:29 am    Post subject: Reply with quote

z'1000' is the hexadecimal constant. The LVM_* commands all start at Z'1000'.

This is the same as 4096.

Again, if you make the first appear as the default, then how do you make the last appear?

Better to not make any appear if multiples are permitted and use this little ditty to show the one you want.
Back to top
View user's profile Send private message Visit poster's website
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Thu Sep 08, 2016 4:16 am    Post subject: Reply with quote

but if you allow multiple selections, how do you know in advance (in order to program) which one is required to be shown ?

Anyway I'm sure Paul will sort it and provide all the likely required permutations when he's available to do so.
Back to top
View user's profile Send private message
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Thu Sep 08, 2016 4:45 am    Post subject: Reply with quote

That is a valid point; yet, one is still the programmer and can make that decision better for the applications purpose.

For example, I allow the user to select a disconnected list of items to edit, with an option to stop editing whenever they chose. I will highlight the last one they edited, or the last one in the list.

I also allow the user to select a disconnected set of items for deletion. I select the line closest to the first in the set, just as a default.

I could have chosen the opposite way as well. This just made sense to me based on the data presented and how the user interacts with it.
Back to top
View user's profile Send private message Visit poster's website
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Thu Sep 08, 2016 5:29 am    Post subject: Reply with quote

I uess it all boils down to how gooėd the choice is in the eyes of the user-base.
Funnily enough today I was clearing out my 'downloads' list in Firefox and sonėmething there really annoys me, and which illustrates your point I think.
If you select a number of items to delete from the history (of downloads), when you hit enter and the items are deleted the whole list scrolllsls upwards and you thn have to scroll back up (sometimes a long way) to get back tothe position of the first item deleted !
Very annoying as the best imo would be to automatically position items from that point in the window so yo ucan then contnue scouring the list from there onwards.
Of course other people may prefer it as it is ... I guess ... but then not everyone can be right Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group