Re: Win32Lib: making a "List Table"? insertItem not work right?

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

Brian,

I merged your list box line parser into your tabbed list box, & it seems to
work pretty good!  Thanks again for taking the time to find & snip & send
the tabbed list box, & to show me how to parse a line in it.

Just had to fix the parser to handle the double tabs in your example text
(trivial, but took me an embarrassingly long time to even realize WHY data
from the third column wouldn't display after being abstracted from the
list--the
double tabs made the parser think there were 4 columns, with an "empty" 3rd
one).

However I'm running into a weird problem putting stuff back INTO the list in
a "column indexed" sense; I have the core of it working just fine, (again
after more time than I would like to admit), but at the end of it when I use
the "insertItem" function, it inserts at index plus TWO instead of where I
specify.

I thought at first it might be because I used the #80 for the list box to
make
it unsorted like you mentioned to Judith, so I went to your original list
box
example & just added an "insertItem at position one", and it inserted it at
position 3 instead.

Any ideas why insertItem isn't working as I tell it to??

Dan Moyer


------------------------- BEGIN CODE ---------------------------------
-- NOTE: identical to your original, just added:
-- "  dummy = insertItem(MainWinClientListBox,"Should be position 1",1)"
--  after your addItems in onOpen

-- tabstops example
without warning
include Win32lib.ew

constant WS_FIXEDFRAME = #4A0000
constant WS_PASSWORD = #20
--===================================================================
-- OBJECT DEFINITIONS
--====================================================================
-- WINDOWS
global constant MainWin =
create(Window, "Server Console [Cheyenne 199.200.201.1]",
0, 0, 0, 300, 600, 0 )--WS_FIXEDFRAME
--====================================================================
-- GROUP BOXES
global constant MainWinClientGroup =
create(Group, "Client Info", MainWin, 2, 48, 300, 480, 0 )
--====================================================================
-- LIST BOXES
global constant MainWinClientListBox = --#82 makes the listBox use
create(List,"",MainWin, 10,100,282,192,#82) -- tabstops and be sorted!
--=====================================================================
-- STAT TEXTS
global constant MainWinStatText1 =
create(LText,"Conn.",MainWin, 10, 82, 40, 16, 0)
global constant MainWinStatText2 =
create(LText,"Username",MainWin, 60, 82, 80, 16, 0)
global constant MainWinStatText3 =
create(LText,"IP Address",MainWin, 156, 82, 140, 16, 0)
--===================================================================
procedure onOpenMainWin()

integer x, y
object dummy

-- set up the MainWindow object
setWindowBackColor(MainWin,rgb(192,192,192))
setFont(MainWin,"MS Sans Serif",8,0)

-- trap the mouse
captureMouse(MainWin)
setMousePointer(MainWin,AppStartingPointer)

-- center MainWin on the user's screen (won't work with resolutions of <
-- 800x600)
--moveWindow(MainWin,x-155,y-300,310,600,1)

-- set up the ListBox objects
setFont(MainWinClientListBox,"MS Sans Serif",8,0)
addItem(MainWinClientListBox,"002\ttstarns \t\t199.240.168.14")
addItem(MainWinClientListBox,"004\tjjones \t\t199.240.168.225")
addItem(MainWinClientListBox,"013\tartmac \t\t199.240.168.33")
addItem(MainWinClientListBox,"017\tdstemet \t\t199.240.168.11")
addItem(MainWinClientListBox,"008\tjmiller \t\t199.240.168.38")
addItem(MainWinClientListBox,"011\tjdawson \t\t199.240.168.73")
addItem(MainWinClientListBox,"009\ttblake \t\t199.240.168.215")
addItem(MainWinClientListBox,"010\tsharden \t\t199.240.168.28")
addItem(MainWinClientListBox,"003\ttgreer \t\t199.240.168.221")
addItem(MainWinClientListBox,"012\tcpotter \t\t199.240.168.151")
addItem(MainWinClientListBox,"018\ttmcleod \t\t199.240.168.27")
addItem(MainWinClientListBox,"020\tbela \t\t199.240.168.5")
addItem(MainWinClientListBox,"021\tpi2 \t\t199.240.168.4")
addItem(MainWinClientListBox,"022\tboulder \t\t199.240.168.2")
addItem(MainWinClientListBox,"023\tkansa \t\t199.240.168.9")


  dummy = insertItem(MainWinClientListBox,"Should be position 1",1)

-- return the mouse to normal
releaseMouse()
setMousePointer(MainWin,ArrowPointer)

end procedure
--========================================================================
-- EVENT HANDLERS
onOpen[MainWin] = routine_id("onOpenMainWin")
--========================================================================
-- WINMAIN
WinMain( MainWin, Normal )

-------------------------------END CODE------------------------------------

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

Search



Quick Links

User menu

Not signed in.

Misc Menu