 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
wahorger

Joined: 13 Oct 2014 Posts: 1257 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: 1257 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 |
|
 |
wahorger

Joined: 13 Oct 2014 Posts: 1257 Location: Morrison, CO, USA
|
|
Back to top |
|
 |
wahorger

Joined: 13 Oct 2014 Posts: 1257 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 |
|
 |
wahorger

Joined: 13 Oct 2014 Posts: 1257 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 |
|
 |
wahorger

Joined: 13 Oct 2014 Posts: 1257 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 |
|
 |
|
|
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
|