Re: Win32Lib: making a "List Table"?

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

Hi again,

Also, I just remembered a project I did where I used tabstops in a listview
to create "columns" of text for connections, usernames, and IP addresses.
I don't think the company I did this for would like it if I posted the
source code for their server front-end on the 'net, but I cut out the
example and dumped in some sample records so you can see how I did it.  The
key is to create() a List object, and give it the style parameter #82
rather than 0.


-------------------------   BEGIN CODE ---------------------------------
-- 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, 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,392,#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

  -- 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)
  x=floor(c_func(xGetSystemMetrics,{SM_CXFULLSCREEN})/2)
  y=floor(c_func(xGetSystemMetrics,{SM_CYFULLSCREEN})/2)
  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,"015\tnphinney\t\t199.240.168.87")
  addItem(MainWinClientListBox,"004\tjjones  \t\t199.240.168.225")
  addItem(MainWinClientListBox,"013\tartmac  \t\t199.240.168.33")
  addItem(MainWinClientListBox,"005\tdgabriel\t\t199.240.168.28")
  addItem(MainWinClientListBox,"001\tbjackson\t\t199.240.168.52")
  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,"014\tmetropub\t\t199.240.168.35")
  addItem(MainWinClientListBox,"010\tsharden \t\t199.240.168.28")
  addItem(MainWinClientListBox,"003\ttgreer  \t\t199.240.168.221")
  addItem(MainWinClientListBox,"006\tjsellers\t\t199.240.168.72")
  addItem(MainWinClientListBox,"007\tmrandall\t\t199.240.168.13")
  addItem(MainWinClientListBox,"012\tcpotter \t\t199.240.168.151")
  addItem(MainWinClientListBox,"016\tkinkelaa\t\t199.240.168.41")
  addItem(MainWinClientListBox,"018\ttmcleod \t\t199.240.168.27")
  addItem(MainWinClientListBox,"019\tjwilliam\t\t199.240.168.89")
  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")


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

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

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

Enjoy!
Brian

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

Search



Quick Links

User menu

Not signed in.

Misc Menu