programming tools for Windows applications development
  Home  |   SwiftForth Archive  |   SwiftX Archive  |

Listview control...

From: Alberto Santini <albertosantini_at_tiscalinet.it>
Date: Thu, 16 Aug 2001 14:30:00 +0200

Just a little example about the creation of the listview control.
How to resize the control when the application window is resized?

{ ==============================================================
listview.f
120716AUG01 Alberto Santini
http://web.tiscali.it/albertosantini
============================================================== }

OPTIONAL LISTVIEW ListView Component

EMPTY

REQUIRES WINAPP

ONLY FORTH DEFINITIONS DECIMAL

\ Window Class Name
CREATE WC_LISTVIEW ,Z" SysListView32"

\ Structs Common Controls
CLASS LV_COLUMN
   VARIABLE .imask
   VARIABLE .fmt
   VARIABLE .cx
   VARIABLE .pszText
   VARIABLE .cchTextMax
   VARIABLE .iSubItem
END-CLASS

\ Messages Common Controls
LVM_FIRST 27 + CONSTANT LVM_INSERTCOLUMN

: LV_AddColumn ( hwndCtrl iSubItem pszText cx -- flag )
   [OBJECTS LV_COLUMN MAKES lvcol OBJECTS]

   LVCF_FMT LVCF_WIDTH OR
   LVCF_TEXT OR
   LVCF_SUBITEM OR
   lvcol .imask !
   LVCFMT_LEFT lvcol .fmt !
   lvcol .cx !
   lvcol .pszText !
   lvcol .iSubItem !
   LVM_INSERTCOLUMN 0 lvcol ADDR SendMessage
   ;

: LV_Create ( hwndParent -- hwndCtrl )
   [OBJECTS RECT MAKES rcClient OBJECTS]

   DUP >R rcClient left GetClientRect DROP
   0 \ extended style
   WC_LISTVIEW \ window class name
   Z" ListView" \ caption
   WS_VISIBLE WS_CHILD OR
   WS_BORDER OR
   LVS_REPORT OR \ window style
   0 \ x
   0 \ y
   rcClient right @ \ width
   rcClient bottom @ \ height
   R> \ parent window handle
   NULL \ window menu handle
   HINST \ program instance handle
   NULL \ creation parameter
   CreateWindowEx
   ;

\ DEMO

: LVDEMO ( -- )
   AppStart \ basic window
   LV_Create \ create control
   DUP 0 Z" Col1" 100 LV_AddColumn DROP \ adding columns
   DUP 1 Z" Col2" 100 LV_AddColumn DROP \ adding columns
   DUP 2 Z" Col3" 100 LV_AddColumn DROP \ adding columns
   DROP
   ;

CR
CR .( Type LVDEMO to run the demo.)
CR

Thanks,
Alberto Santini
(Eta Sistemi)
___________________________________________________________

Work Mail mailto:asantini_at_etasistemi.it

Personal Mail mailto:albertosantini_at_tiscalinet.it
Personal HomePage http://web.tiscalinet.it/albertosantini

__m_OO_m__

: QUIT ( -- ) BEGIN RESET QUERY INTERPRET AGAIN ;

PGP: Ask me my public key or
     download it from my homepage or
     in key server looking for KeyID 0x91C01149
___________________________________________________________

----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe sftalk" to listar_at_forth.com
For help with listar commands, send subject "help" to listar_at_forth.com
Archives are located at http://www.forth.com/sftalk -- check them out!
Search the archives! Visit http://www.forth.com/search for details.
Received on Thu Aug 16 2001 - 05:30:05 PDT

This archive was generated by hypermail 2.2.0 : Thu Nov 20 2008 - 03:04:19 PST