Win32Lib: making a "List Table"?

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

I think I would like to use a "List Table" in an app, (like a list box, but
in table format to show association between items); when an item in one part
of the table is selected, the whole line is too.

I made a simple example, but I wonder if it couldn't be better.  My concerns
with it are:
1.  since I made it by just putting list boxes side by side, I don't know
how well that "registration" works on systems with other video settings;
it's *supposed* to look simply like a table, & does on my system;
2.  it "jerks" when items in it are selected, because the primary selected
item responds to mouse button down, and the others don't respond until mouse
button goes up.

Any suggestions?  (perhaps this is a candidate for a new control??)

Dan Moyer

-- code begins:

--  code generated by Win32Lib IDE v0.8
--  A LIST TABLE:
--  information is displayed in table form, and selecting any item selects
--  its associated parameters on same line of table

include Win32Lib.ew
without warning

-----------------------------------------------------------------------
--  Window Window1
global constant Window1 = create( Window, "a List Table", 0, Default,
Default, 780, 456+ 19, 0 )
global constant List1 = create( List, "List1", Window1, 100, 60, 199, 120,
0 )
global constant List2 = create( List, "List2", Window1, 300, 60, 200, 120,
0 )
global constant List3 = create( List, "List3", Window1, 501, 60, 200, 120,
0 )
global constant Label1  = create(CText, "Click on an item, and associated
parameters will also be selected:", Window1, 100, 20, 550, 28, 0)
--------------------------------------------------------------------------
-- populate lists with stuff on open:
procedure Window1_onOpen ()

addItem(List1,"an item")
addItem(List1,"another item")
addItem(List2,"1st parameter")
addItem(List2,"another 1st parameter")
addItem(List3,"2nd parameter")
addItem(List3,"another 2nd parameter")

-- set top line in all lists selected if anything in at least one of them:
if getCount(List1) > 0 or getCount(List2) > 0
 or getCount(List3) > 0 then
   setIndex(List1, 1)
   setIndex(List2, 1)
   setIndex(List3, 1)
end if
end procedure
onOpen[Window1] = routine_id("Window1_onOpen")

-----------------------------------------------
-- when item in list1 is selected, things in other lists on same line
-- are also selected
procedure List1_onChange ()
object result
integer index
index = getIndex(List1)
if index> 0 then
   setIndex(List2,index)
   setIndex(List3,index)
end if
end procedure
onChange[List1] = routine_id("List1_onChange")

------------------------------------------------------------------------

WinMain( Window1, Normal )

-- code ends

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

Search



Quick Links

User menu

Not signed in.

Misc Menu