![]() |
||
| Home | SwiftForth Archive | SwiftX Archive | |

Below is pasted source for an include file, which when loaded
makes a window with 2 listbox panes, and some buttons.
1. Clicking in a listbox makes a dotted selection rectangle appear,
but it does not extend the width of the box. Are there any
properties or settings to make the dots - selection width - go
right across the box?
2. See hb0,1,2,3
I can make an indexed array using variables, but is there a way
to make an indexed array of values to use in a do loop ?
thanks,
Anil
\ ------------------------------------------------------------------
CREATE TopName ,Z" BtnsnBxs"
0 VALUE hTop
[SWITCH TopCOMMANDS ZERO ( cmd -- res )
SWITCH]
[SWITCH TopMESSAGES DEFWINPROC ( -- res )
WM_DESTROY RUN: 0 TO hTop ( 0 PostQuitMessage DROP ? ) 0 ;
WM_COMMAND RUN: WPARAM LOWORD TopCOMMANDS ;
SWITCH]
:NONAME MSG LOWORD TopMESSAGES ; 4 CB: TopProc
: TopWINDOW ( -- hwnd )
0 \ extended style
TopName \ window class name
Z" CANVAS" \ window caption
WS_OVERLAPPEDWINDOW \ window style
500 100 500 400
0 \ parent window handle
0 \ window menu handle
HINST \ program instance handle
0 \ creation parameter
CreateWindowEx ;
\ -------------------------------------------------------------
: listWINDOW ( hwnd -- hwnd )
>R
WS_EX_CLIENTEDGE \ extended style
Z" listbox" \ window class name
z" Segments"
WS_CHILD
WS_VISIBLE OR
LBS_USETABSTOPS OR \ doesn't truncate over run
WS_EX_CLIENTEDGE OR
ES_NOHIDESEL OR \ window style
0 0 0 0
R> \ parent window handle
0 \ window menu handle
HINST \ program instance handle
0 \ creation parameter
CreateWindowEx ;
0 VALUE hlst
: LWinCREATE ( -- res ) HWND listWINDOW TO hlst ;
0 VALUE hdw
: DWinCREATE ( -- res ) HWND ListWINDOW TO hdw ;
: cx ( -- x ) LPARAM LOWORD ;
: cy ( -- y ) LPARAM HIWORD ;
\ : CY hTop client-height ;
: qdl 0 50 200 cy 50 - ;
: qdd 200 0 cx 200 - cy ;
: ldsize ( -- res )
hlst ( wsize) qdl 1 MoveWindow DROP \ size try
hdw ( wsize) qdd 1 MoveWindow DROP \ size try
0 ;
\ --------------------------------------------------------------------
[+SWITCH TopMESSAGES ( msg -- res )
WM_CREATE RUN: DWinCREATE LWinCREATE 0 ;
WM_SIZE RUNS ldsize
SWITCH]
: go ( -- )
hTop ?EXIT
TopName TopProc DefaultClass DROP
TopWINDOW TO hTop
hTop DUP SW_SHOWDEFAULT ShowWindow DROP
UpdateWindow DROP ;
: try LWincreate
hlst DUP SW_SHOWDEFAULT ShowWindow DROP
UpdateWindow DROP ;
\ ---------------------------------------------------------
:PRUNE hTop DestroyWindow DROP 0 TO hTop
TopName HINST UnregisterClass DROP ;
0 value hb0 0 value hb1
0 value hb2 0 value hb3
: istr ( i -- zstr )
case 0 of z" HI" endof
1 of z" HO" endof
2 of z" HE" endof
3 of z" HA" endof
z" Out" swap
endcase ;
: tohbi ( hbtn i -- ) \ kluge using values
case 0 of to hb0 endof
1 of to hb1 endof
2 of to hb2 endof
3 of to hb3 endof
drop
endcase ;
: ibtn ( i -- hbtn) >r \ index i
0
z" button"
r@ istr
WS_VISIBLE WS_CHILD or BS_PUSHBUTTON or
BS_PUSHLIKE or
r@ 50 * 2+ 2 47 47
hTop
r> 1000 + \ makes ID's 1000, 1001, 1002, 1003
hinst
0
CreateWindowEx ; \ to hbi
: btns 4 0 do i ibtn i tohbi loop ;
: sho hb0 . hb1 . hb2 . hb3 . ;
: ads hlst LB_ADDSTRING 0 z" TRY IT this is a longer line"
SendMessage drop ;
[+SWITCH TopCOMMANDS ( cmd -- res )
1001 run: ads 0 ;
SWITCH]
: lbx go btns ;
lbx
\\
----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and
bug reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Mon Nov 27 2006 - 09:58:39 PST
This archive was generated by hypermail 2.2.0 : Tue Dec 02 2008 - 03:04:41 PST