Re: Listview help needed

new topic     » goto parent     » topic index » view thread      » older message » newer message

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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu