Silverfrost Forums

Welcome to our forums

Showing highlighted entry in list view %lv

20 Jul 2009 11:38 #4807

List view may well contain more entries than can be displayed - hence the vertical scroll bar.

We know the previously selected entry so this gets highlighted ; but, this might not be in the first display pane.

Why cannot %lv align the highlighted entry, say, in the middle of the pane instead of the entry being out of sight ? Is there an option that would permit this ?

20 Jul 2009 12:08 #4808

I am not exactly sure what you are asking for but %lv provides a wrapper for a Microsoft listview control so basically you get whatever the Microsoft control provides.

I cannot find a message for the control that does the trick but it may be possible to do something with the API SendMessage using (say) LVM_SCROLL.

7 Aug 2009 11:46 #4874

Thanks for responding, Paul, sorry it has taken to come back to you.

The documented parameter for %lv called sel will get set according to which entry one requires to be the default / highlighted entry.

If the list is massive then all the entries cannot be presented hence the use of the vertical scroll bar. Now, if ones entry in the list is beyond the bottom of those displayable this surely does not look presentable - one has to scroll down the list to find if any have been set.

Simple question : if there are set entries in parameter sel and they are not able to be seen from the initial display ( starting at entry 1 ) why cannot Clearwin+ automatically scroll down leaving the first selected entry in, say, the middle of the displayed list ?

7 Aug 2009 3:03 #4879

Looks like you need to find a way to apply the message LVM_ENSUREVISIBLE.

Look in the help file for %lv and the associated 'callback_reason' SET_SELECTION. The ROW_NUMBER gives the index (parhaps with an offset of one).

You can get the HWND using %lc and use PostMessage with LVM_ENSUREVISIBLE in your callback. See MSDN listview control for details.

I will see if I can make this automatic for the next release.

13 Aug 2009 12:00 #4900

I have now modified %lv for the next release of salflibc.dll.

For a single selection, an initial selection will now automatically scroll into view.

29 Oct 2009 12:56 #5282

Thanks for updating Clearwin.

I see that the update is logged in 5.40 as amendment 294 but, sadly, I cannot get it to work !

An example of the %lv call is as follows :

  I = WINIO@('%^lv[show_selection_always,full_row_select]&',
 *           NWID, IYW, CITEMS, NCL(IND,INDTYP)+1,
 *           ITEMS(1,IND,INDTYP), 1, MNLIST)

If the callback method so stated before works could you please give an example of code.

29 Oct 2009 6:39 #5285

You need to download the latest version of the DLL. It comes with version 5.40 of FTN95. Then make sure that you are using the new DLL and not accessing a copy of an old DLL on your machine.

If you are sure about using the correct version and the problem persists then post a complete working program and I will aim to take a look at it.

30 Oct 2009 8:25 #5288

Hello Paul,

It seems, that highligthing the selected row does not work in combination with the option edit_cells. See my little example:

program test_lv
      character(len=18),dimension(0:10) :: items
      integer,dimension(10)             :: sel
      integer                           :: num, view, i, iw
      
      
      view = 1
      num = 11
      sel = 0
      sel(8) = 1
     
      items(0) = '|A_60|B=2*A_60'
      do i=1,10
        write(items(i),'(2(a1,i8))') '|',i,'|',2*i
      enddo
      iw=winio@('%lv[single_selection,edit_cells]&',300,100,items,num,sel,view)
      iw=winio@('%bt[Close]')
      
      stop
      end

This listview does not show any highligthed row, until you remove the edit_cell option.

30 Oct 2009 11:13 #5289

Thanks to Paul and Ralf for eluding to the fact that the SINGLE_SELECTION option needs to be used. I can now get this to work as you intended.

I have two observations :

  1. is it standard to have the highlighted line at the bottom of the screen or would it not be better mid-table ?

  2. why should the approach not be adopted for multi-selection cases, ie when SINGLE_SELECTION is not provided ? Currently, if there were many selections with one of them on the first screen one would not be aware there were other selected items further down the list. To be sure NO items are highlighted you would need to find a contiguous screen full of items that have no selection - surely, hardly worth the effort. So you might as well go highlight the first item !

30 Oct 2009 4:16 #5291

The result is what you get with the message LVM_ENSUREVISIBLE applied to a Microsoft listview control. In that sense it is standard.

I will have to check whether the single selection is necessary.

2 Nov 2009 12:19 #5300

Paul,

Could you please show me what is required in FTN95, thank you

2 Nov 2009 1:23 #5302

Sorry, I don't understand the question. What is it that you want to do?

2 Nov 2009 1:50 #5303

I have now had a look at my coding for %lv and can confirm that the new code to scroll the initial selection into view only works for single selection mode. If I were to remove this constraint then, with multiple initial selections, as it is the last one that would scroll into view. But I could change this to make the first scroll into view which would seem more sensible.

When using edit_cells it looks like single_selection is implied and any initial selection is cancelled.

2 Nov 2009 3:03 #5308

Not needing to introduce API commands and leaving it to Clearwin+ to perform the automatic highlighting of selected lines would be much appreciated.

Hightlighting the first of any multi selections would be acceptable.

Thanks

Please login to reply.