View previous topic :: View next topic |
Author |
Message |
wahorger
Joined: 13 Oct 2014 Posts: 1217 Location: Morrison, CO, USA
|
Posted: Fri Sep 02, 2016 11:36 pm Post subject: List view (%lv) control does not update view properly |
|
|
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 |
|
|
wahorger
Joined: 13 Oct 2014 Posts: 1217 Location: Morrison, CO, USA
|
Posted: Sat Sep 03, 2016 4:04 pm Post subject: |
|
|
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 |
|
|
John-Silver
Joined: 30 Jul 2013 Posts: 1520 Location: Aerospace Valley
|
Posted: Tue Sep 06, 2016 7:26 pm Post subject: |
|
|
... 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 |
|
|
wahorger
Joined: 13 Oct 2014 Posts: 1217 Location: Morrison, CO, USA
|
|
Back to top |
|
|
wahorger
Joined: 13 Oct 2014 Posts: 1217 Location: Morrison, CO, USA
|
Posted: Tue Sep 06, 2016 8:02 pm Post subject: |
|
|
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 |
|
|
John-Silver
Joined: 30 Jul 2013 Posts: 1520 Location: Aerospace Valley
|
Posted: Wed Sep 07, 2016 1:26 am Post subject: |
|
|
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 |
|
|
wahorger
Joined: 13 Oct 2014 Posts: 1217 Location: Morrison, CO, USA
|
Posted: Wed Sep 07, 2016 3:29 am Post subject: |
|
|
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 |
|
|
John-Silver
Joined: 30 Jul 2013 Posts: 1520 Location: Aerospace Valley
|
Posted: Thu Sep 08, 2016 4:16 am Post subject: |
|
|
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 |
|
|
wahorger
Joined: 13 Oct 2014 Posts: 1217 Location: Morrison, CO, USA
|
Posted: Thu Sep 08, 2016 4:45 am Post subject: |
|
|
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 |
|
|
John-Silver
Joined: 30 Jul 2013 Posts: 1520 Location: Aerospace Valley
|
Posted: Thu Sep 08, 2016 5:29 am Post subject: |
|
|
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 |
|
Back to top |
|
|
|