Re: COMING REAL SOON !
- Posted by euman at bellsouth.net
Jul 21, 2001
cosider this listview.ew file
global constant
LVS_REPORT = 1,
LVS_SHOWSELALWAYS = 8,
LVIF_TEXT = #0001,
LVIF_PARAM = #0004,
LVIS_SELECTED = #0002,
LVNI_FOCUSED = 1,
LVCF_FMT = 1,
LVCF_WIDTH = 2,
LVCF_TEXT = 4,
LVCF_SUBITEM = 8,
LVCF_ORDER = 20,
LVCFMT_LEFT = 0,
LVM_INSERTCOLUMN = 4123,
LVS_SHAREIMAGELISTS = 40,
LVM_SETITEM = 4102,
LVM_INSERTITEM = 4103,
LVM_GETNEXTITEM = 4108,
LVM_SETBKCOLOR = 4097,
LVM_SETTEXTBKCOLOR = 4134,
LVM_SETTEXTCOLOR = 4132,
LVM_SETEXTENDEDLISTVIEWSTYLE = 4150,
LVS_EX_GRIDLINES = 1,
LVS_EX_TRACKSELECT = 8,
LVS_EX_HEADERDRAGDROP = 10,
LVS_EX_FULLROWSELECT = 20,
LVS_EX_ONECLICKACTIVATE = 40
constant
lvcol_mask = 0,
lvcol_fmt = 4,
lvcol_cx = 8,
lvcol_pszText = 12,
lvcol_cchTextMax = 16,
lvcol_iSubItem = 20,
lvcol_iOrder = 24,
sizeof_lvcol = 28
global constant
lvitem_mask = 0,
lvitem_iItem = 4,
lvitem_iSubItem = 8,
lvitem_state = 12,
lvitem_stateMask = 16,
lvitem_pszText = 20,
lvitem_cchTextMax = 24,
lvitem_iImage = 28,
lvitem_lParam = 32,
lvitem_iIdent = 36,
sizeof_lvitem = 40
global constant
LVN_COLUMNCLICK = -108,
NM_CLICK = -2,
LVM_GETITEM = 4101,
LVM_GETITEMSTATE = 4140,
LVM_GETSELECTEDCOUNT = 4146
global atom ListView1, lvcol
-- create a listview
global function MakeListView(atom hwnd, sequence name, integer x1, integer y1,
integer x2, integer y2)
atom id, szName, szName2, lvMask
object junk
lvMask =
or_all({LVS_EX_HEADERDRAGDROP,LVS_EX_GRIDLINES,LVS_EX_ONECLICKACTIVATE })
szName = allocate_string("SysListView32")
szName2 = allocate_string(name)
id = c_func(CreateWindow,{WS_EX_CLIENTEDGE,
szName,
szName2,
or_all({WS_CHILD,
WS_TABSTOP,
WS_VISIBLE,
WS_BORDER,
LVS_REPORT
}),
x1,
y1,
x2,
y2,
hwnd,
0,
hInst,
NULL})
free(szName)
free(szName2)
junk = c_func(SendMessage,{id, LVM_SETEXTENDEDLISTVIEWSTYLE, lvMask, lvMask})
junk = c_func(SendMessage,{id,LVM_SETBKCOLOR, 0, 16744576})
junk = c_func(SendMessage,{id,LVM_SETTEXTBKCOLOR, 0, 16744576})
junk = c_func(SendMessage,{id,LVM_SETTEXTCOLOR, 0, 16777088})
lvcol = allocate_struct(sizeof_lvcol)
poke4( lvcol + lvcol_mask, or_all({LVCF_FMT, LVCF_SUBITEM, LVCF_TEXT,
LVCF_WIDTH}))
poke4( lvcol + lvcol_fmt, LVCFMT_LEFT)
return id
end function
-- add listview columns
global procedure ListView_Column(atom id, sequence text, integer item, integer
width )
atom itxt, junk
itxt = allocate_string(text)
poke4( lvcol + lvcol_cx, width)
poke4( lvcol + lvcol_pszText, itxt )
poke4( lvcol + lvcol_iSubItem, item )
junk = c_func(SendMessage,{id, LVM_INSERTCOLUMN, 0, lvcol})
free(itxt)
end procedure
-- The above code is already done for you so,
-- Start of your program
include listview.ew
-- Then in your main winproc( )
if iMsg = WM_CREATE then
ListView1 = MakeListView(hwnd, "ListView1", 210, 70, 400, 150)
ListView_Column(ListView1, "Column One", 0, 133 )
ListView_Column(ListView1, "Column Two", 1, 133 )
this is all is required to create a listview I dont particularly want the extra
processes involved
with renameing. This code also sets colors for the listview, the text and adds
extended styles
all in one little tiny swoop. Anyone that looks at this can take the color
setting features out
for a particular project but thats what makes it fun and alows others to learn
the API as well.
The code to handle notification messages is done for you too and can be
configured easily
as well.
Look easy? It is! Wait a mnth or so and see.
I still have to finish a little project for PATRAT thats fallen behind.
Euman
euman at bellsouth.net
|
Not Categorized, Please Help
|
|