Silverfrost Forums

Welcome to our forums

Selection of all items in %lv

15 Jul 2008 7:14 #3460

How can I select all items of a listview by pressing 'ctrl A' for example? I have build a callback function for 'ctrl A'. There I am setting the select array to 1 and I use call window_update@(items) to update all items. But nothing is happening???

15 Jul 2008 9:50 #3461

Either set the return value of your %ac[CTRL+A] callback to 1 to update all controls, or call window_update@(sel) within the callback, where 'sel' is the integer*4 array whose elements are set to 1 if the item is selected otherwise to zero.

I used %lv[show_selection_always,full_row_select]

Regards

Ian

16 Jul 2008 3:37 #3468

Maybe I have not explained my problem exactly:

If I select some (or all) item(s) in the sel array and update all controls, I expect to see the selected items highlighted.

Also if I preselect some items before calling %lv none of them are highlighted.

17 Jul 2008 6:15 #3471

Try this: This initially sets items 1 and 3 to selected CTRL+A sets all using callback return of 1 CTRL+B sets all using callback return of 2 & call window_update@(sel) CTRL+C sets items 2, 4 & 6 using callback return of 1

It works for me FTN95 version 5.21.0

Regards

Ian

!Selecting cells in %lv
!
include <windows.ins>
PARAMETER (N=20)
INTEGER sel,view
CHARACTER*200 info
COMMON   sel(n-1),view,info(n)
INTEGER select_all, select_all_by_update, select_some
EXTERNAL select_all, select_all_by_update, select_some
sel          = 0
sel(1)       = 1
sel(3)       = 1
info         = ' '  
info( 1) = '|N1_+|N2_+|ODs_+45|ODe_+45|IDs_+45|IDe_+45|Length_+55|Elasticity_+55|Density_+55|Split_+45|N1inc_+45|N2inc_+45'
info( 2) = '|aa|||||||||||'
info( 3) = '|bb|||||||||||'
info( 4) = '|cc|||||||||||'
info( 5) = '|dd|||||||||||'
info( 6) = '|ee|||||||||||'
info( 7) = '|ff|||||||||||'
info( 8) = '|gg|||||||||||'
info( 9) = '|hh|||||||||||'
info(10) = '|ii|||||||||||'
info(11) = '|jj|||||||||||'
info(12) = '|kk|||||||||||'
info(13) = '|ll|||||||||||'
info(14) = '|mm|||||||||||'
view=1
!create list view display 
i=winio@('%ww%ca[Listview Select Sample]&')
i=winio@('%bg[btnface]&')
i=winio@('%lv[show_selection_always,full_row_select]&',600,220,info,N,sel,view)
i=winio@('%ac[CTRL+A]&',select_all)
i=winio@('%ac[CTRL+B]&',select_all_by_update)
i=winio@('%ac[CTRL+C]&',select_some)
i=winio@(' ')

END


integer*4 function select_all()
PARAMETER (N=20)
INTEGER sel,view
CHARACTER*200 info
COMMON   sel(n-1),view,info(n)
select_all = 1
sel = 1
end

integer*4 function select_all_by_update()
PARAMETER (N=20)
INTEGER sel,view
CHARACTER*200 info
COMMON   sel(n-1),view,info(n)
select_all_by_update = 2
sel = 1
call window_update@(sel)
end

integer*4 function select_some()
PARAMETER (N=20)
INTEGER sel,view
CHARACTER*200 info
COMMON   sel(n-1),view,info(n)
select_some = 1
sel = 0
do i=2,6,2
  sel(i) = 1
enddo
end
Please login to reply.