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 

Showing highlighted entry in list view %lv

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



Joined: 23 Feb 2007
Posts: 73

PostPosted: Mon Jul 20, 2009 12:38 pm    Post subject: Showing highlighted entry in list view %lv Reply with quote

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 ?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Mon Jul 20, 2009 1:08 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address
Steve



Joined: 23 Feb 2007
Posts: 73

PostPosted: Fri Aug 07, 2009 12:46 pm    Post subject: Reply with quote

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 ?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Fri Aug 07, 2009 4:03 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Thu Aug 13, 2009 1:00 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address
Steve



Joined: 23 Feb 2007
Posts: 73

PostPosted: Thu Oct 29, 2009 1:56 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Thu Oct 29, 2009 7:39 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address
Ralf



Joined: 30 Aug 2007
Posts: 50
Location: munich

PostPosted: Fri Oct 30, 2009 9:25 am    Post subject: Reply with quote

Hello Paul,

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

Code:

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.
Back to top
View user's profile Send private message
Steve



Joined: 23 Feb 2007
Posts: 73

PostPosted: Fri Oct 30, 2009 12:13 pm    Post subject: Reply with quote

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 !
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Fri Oct 30, 2009 5:16 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address
Steve



Joined: 23 Feb 2007
Posts: 73

PostPosted: Mon Nov 02, 2009 1:19 pm    Post subject: Reply with quote

Paul,

Could you please show me what is required in FTN95, thank you
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Mon Nov 02, 2009 2:23 pm    Post subject: Reply with quote

Sorry, I don't understand the question.
What is it that you want to do?
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Mon Nov 02, 2009 2:50 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address
Steve



Joined: 23 Feb 2007
Posts: 73

PostPosted: Mon Nov 02, 2009 4:03 pm    Post subject: Reply with quote

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
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