1. Listview help needed
Hi all,
I have been confused and would like some assistance,
Let me try to explain to you what i'm trying to do before i ask
this question. I'm creating a program that
has a listview with 4 columns.
inboxlv = create(ListView,"",mainwindow,124,43,506,100,or_all({LVS_REPORT,
LVS_NOSORTHEADER}))
--Columns for the inbox listview
insertListViewColumn(inboxlv,0,0,LVCFMT_LEFT,45, "Priority",0)
insertListViewColumn(inboxlv,1,0,LVCFMT_LEFT,160, "From:",0)
insertListViewColumn(inboxlv,2,0,LVCFMT_LEFT,170,"Subject:",0)
insertListViewColumn(inboxlv,3,0,LVCFMT_CENTER,120,"Received",0)
the program also has a menu containing four menuitems, i want when the first
menuitem is pressed, the first
column "Priority" is sorted in ascending order, if the second menu item is
pressed the second column is
sorted in ascending order ans so on......(Just ascending order)
I read something in the win95hlp that if you simply use LVS_SORTASCENDING
the work would be done for
me automatically however that is not working, when i create my listview with
that style, no listview item is
shown.
I'm currently using the win32lib ver 55.5 , i tried copying a procedure
found in win32lib 56 called
sort items(). it does the work but if you call it the second time it sorts
in the opposite of the first sort, more like
what is done, when you click a column header of a listview that was made
without using this style
LVS_NOSORTHEADER
Some one give assistance please.......or code on how you can make a listview
column sort in only ascending order, when a menuItem is clicked
Jordah Ferguson
<jorfergie03 at yahoo.com>
2. Re: Listview help needed
- Posted by annys_n at hotmail.com
Feb 28, 2002
This is a multi-part message in MIME format.
------=_NextPart_000_00E7_01C1C071.BA605F40
charset="iso-8859-1"
Hello,
I think your answer is written in the attachment.
I didn't write it myself, i'm still learning EU & English : )
Greetz,
nancy
PS : thx to all EU-users who send their thoughts, it helps me a lot with my
EU-study
Hope some day I will have something to write too ; )
----- Original Message -----
From: "Matthew Lewis" <matthewwalkerlewis at YAHOO.COM>
To: "EUforum" <EUforum at topica.com>
Sent: Thursday, February 28, 2002 3:00 PM
Subject: RE: Listview help needed
>
>
> > -----Original Message-----
> > From: jordah ferguson [mailto:jorfergie03 at yahoo.com]
> >
> > Some one give assistance please.......or code on how you can
> > make a listview
> > column sort in only ascending order, when a menuItem is clicked
>
> This is a quick fix (it won't allow for descending sorts). In w32lv.ew,
> just comment out anything using 'sign':
>
> integer sign, subitem, column, owner
> sequence text
> sequence textvalue
>
> owner = find(id, lv_id)
> column = lv_allowsort[owner]
> if column < 0 then
> --sign = -1
> column = - column
> --else
> -- sign = 1
> end if
>
> text = { peek_string(lvitem_data[lParam1][2][column][1] ),
> peek_string(lvitem_data[lParam2][2][column][1] ) }
>
> if lv_columnattr[owner][column][sort_numeric] then
> textvalue = TextToNumber({text[1], True})
> if textvalue[2] = 0 then
> text[1] = textvalue[1]
> end if
>
> textvalue = TextToNumber({text[2], True})
> if textvalue[2] = 0 then
> text[2] = textvalue[1]
> end if
> end if
>
> if lv_columnattr[owner][column][sort_case] = False then
> text[1] = lower(text[1])
> text[2] = lower(text[2])
> end if
> return compare(text[1], text[2]) --* sign
> end function
>
>
> Matt Lewis
>
>
>
>
------=_NextPart_000_00E7_01C1C071.BA605F40
Content-Type: application/octet-stream;
name="ListTreeView.EXW"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="ListTreeView.EXW"
-- Demo for Listview wrappers.
-- Matt Lewis (matthewlewis at hotmail.com)
without warning
include win32lib.ew
atom LV, TV
object junk
with trace
constant=20
Win =3D create( Window, "ListView Demo", 0, Default, Default, 640, 460, =
0 )
=20
TV =3D create( TreeView,
"Treeview",
Win,
10,
10,
300, --CW_USEDEFAULT,
300, --CW_USEDEFAULT,
or_all({TVS_HASLINES, TVS_LINESATROOT, TVS_HASBUTTONS,
TVS_SHOWSELALWAYS}))
LV =3D create( ListView,
{ "Library", "Author" },
Win,
320,
10,
300, --CW_USEDEFAULT,
300, --CW_USEDEFAULT,
or_all({LVS_REPORT, LVS_SHOWSELALWAYS}))
atom iExw, ptr, mask, current
current =3D 0
ptr =3D allocate_string( "exw" )
mask =3D or_all( {LVIF_IMAGE, LVIF_PARAM, LVIF_TEXT})
iExw =3D w32Func(xLoadIcon,{instance(), ptr} )
free(ptr)
constant=20
closefolder =3D addIcon( extractIcon( "clsdfold.ico" ) ),
openfolder =3D addIcon( extractIcon( "openfold.ico" )),
win =3D addIcon( iExw ),
dos =3D addIcon( extractIcon( "disk05.ico" )),
linux =3D addIcon( extractIcon( "disk06.ico" )),
generic =3D addIcon( extractIcon( "disks04.ico" ))
sequence folders, location, lParams, lv
folders =3D {}
location =3D {}
lParams =3D {}
folders &=3D addTVItem( TV, closefolder, openfolder, "Windows 1", 0 )
folders &=3D addTVItem( TV, closefolder, openfolder, "DOS 2", 0 )
folders &=3D addTVItem( TV, closefolder, openfolder, "Linux 3", 0 )
folders &=3D addTVItem( TV, closefolder, openfolder, "Generic 4", 0 )
folders &=3D addTVItem( TV, closefolder, openfolder, "Library 5", =
folders[1] )
folders &=3D addTVItem( TV, closefolder, openfolder, "Games 6", =
folders[1] )
folders &=3D addTVItem( TV, closefolder, openfolder, "Library 7", =
folders[2] )
folders &=3D addTVItem( TV, closefolder, openfolder, "Games 8", =
folders[2] )
folders &=3D addTVItem( TV, closefolder, openfolder, "Library 9", =
folders[3] )
folders &=3D addTVItem( TV, closefolder, openfolder, "Games 10", =
folders[3] )
junk =3D sendMessage( Win, WM_SETICON, 0, iExw)
lv =3D {
{ "Win32Lib", "David Cuny", win},
{ "Neil", "Pete Eberlein", dos},
{ "Exotica", "Todd Riggins", win},
{ "Object Euphoria", "Mike Nelson", generic },
{ "Low-level routines", "Bernie Ryan", win},
{ "Euphoria Database System", "RDS", generic},
{ "Remote Procedure Calls", "Pete Eberlein", linux },
{ "Magefire 3D", "Pete King", win },
{ "Euphoria CGI Setup", "Irv Mullins", linux},
{ "Simple Chess Program", "Normand Blaise", linux},
{ "NeilGUI","Lewis Townsend", dos},
{ "Spectre Setup", "Pete King", win},
{ "Saving Master Yoga", "Spocky", win},
{ "Associative Lists", "Jiri Babor", generic},
{ "Mini-Assembler", "Pete Eberlein", generic},
{ "MySQL for Euphoria", "Fabio Ramirez", win },
{ "File and Pipe Libraries", "Jeff Fielding", linux},
{ "X Windows GUI Library", "Irv Mullins", linux },
{ "Lemon Headz Game", "Liquid-Nitrogen", dos},
{ "Matheval", "Matt Lewis", generic}
}
location =3D repeat( 0, length( lv ) )
lParams =3D location
for i =3D 1 to length(location) do
location[i] =3D rand(6) + 4
end for
with trace
procedure droppedTV( integer id, sequence data )
atom item, ix
if id =3D LV then
item =3D hitTestTV( TV )
if item and item !=3D current then
for i =3D 1 to length(data) do =20
ix =3D find(data[i], lParams )
-- Move item to drop location
location[ix] =3D item
-- Remove from display
lParams[ix] =3D 0
ix =3D deleteItem( LV, data[i] )
end for
end if
end if
=20
end procedure
onDragAndDrop[TV ] =3D routine_id("droppedTV")
procedure TV_onChange( )
atom ix
if deleteItem( LV, -1 ) then end if
lParams -=3D lParams
current =3D getIndex( TV )
-- show items
ix =3D 1
while ix <=3D length( location ) do
if location[ix] =3D current then
lParams[ix] =3D addLVItem( LV, lv[ix][3], lv[ix][1..2] )
end if
ix +=3D 1
end while
end procedure
onChange[TV] =3D routine_id( "TV_onChange" )
-- End Code
WinMain( Win, Normal )
------=_NextPart_000_00E7_01C1C071.BA605F40--
3. Re: Listview help needed
no
----- Original Message -----
From: <annys_n at hotmail.com>
To: "EUforum" <EUforum at topica.com>
Subject: Re: Listview help needed
>
> Hello,
>
> I think your answer is written in the attachment.
> I didn't write it myself, i'm still learning EU & English : )
>
> Greetz,
> nancy
>
> PS : thx to all EU-users who send their thoughts, it helps me a lot with
my
> EU-study
> Hope some day I will have something to write too ; )
>
> ----- Original Message -----
> From: "Matthew Lewis" <matthewwalkerlewis at YAHOO.COM>
> To: "EUforum" <EUforum at topica.com>
> Sent: Thursday, February 28, 2002 3:00 PM
> Subject: RE: Listview help needed
>
>
> > > -----Original Message-----
> > > From: jordah ferguson [mailto:jorfergie03 at yahoo.com]
> > >
> > > Some one give assistance please.......or code on how you can
> > > make a listview
> > > column sort in only ascending order, when a menuItem is clicked
> >
> > This is a quick fix (it won't allow for descending sorts). In w32lv.ew,
> > just comment out anything using 'sign':
> >
> > integer sign, subitem, column, owner
> > sequence text
> > sequence textvalue
> >
> > owner = find(id, lv_id)
> > column = lv_allowsort[owner]
> > if column < 0 then
> > --sign = -1
> > column = - column
> > --else
> > -- sign = 1
> > end if
> >
> > text = { peek_string(lvitem_data[lParam1][2][column][1] ),
> > peek_string(lvitem_data[lParam2][2][column][1] ) }
> >
> > if lv_columnattr[owner][column][sort_numeric] then
> > textvalue = TextToNumber({text[1], True})
> > if textvalue[2] = 0 then
> > text[1] = textvalue[1]
> > end if
> >
> > textvalue = TextToNumber({text[2], True})
> > if textvalue[2] = 0 then
> > text[2] = textvalue[1]
> > end if
> > end if
> >
> > if lv_columnattr[owner][column][sort_case] = False then
> > text[1] = lower(text[1])
> > text[2] = lower(text[2])
> > end if
> > return compare(text[1], text[2]) --* sign
> > end function
> >
> >
> > Matt Lewis
> >
> >
>
>
>