[futurebasic] List box

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : July 2000 : Group Archive : Group : All Groups

From: SVANVOORST@...
Date: Wed, 26 Jul 2000 18:42:24 EDT
I am trying to make a list box using control #353.  I created an "ldes" 
resource using a TMPL resource in ResEdit and can draw the control ok.  I 
then created a record containing list elements with a pointer to it and then 
referenced the pointer in FN SETCONTROLDATA.  However, this does not put the 
list elements in the control (see FB^3 code and binHex of resource below).  
Any help would be greatly appreciated.

'****************FB^3 code****************
include "Tlbx Appearance.Incl"
RESOURCES "lBox.rsrc"'contains "ldes" resource

begin RECORD listBoxContents
DIM item1$
DIM item2$
DIM item3$
DIM item4$
DIM item5$
DIM item6$
DIM item7$
DIM item8$
END RECORD

LOCAL
DIM cntrlRect.8
DIM wndPtr&
DIM listH&
DIM osErr%
dim lboxAddr as pointer to listBoxContents
LOCAL FN buildWnd
WINDOW #1,"List Box.demo",(0,0)-(280,280),_docNoGrow_noAutoClip
cntrlRect.top% = 50    :  cntrlRect.left% = 80
cntrlRect.bottom% = 220 : cntrlRect.right% = 200
lboxAddr= fn newptr(sizeof(listBoxContents))
lboxAddr.item1$ = "Item 1"
lboxAddr.item2$ = "Item 2"
lboxAddr.item3$ = "Item 3"
lboxAddr.item4$ = "Item 4"
lboxAddr.item5$ = "Item 5"
lboxAddr.item6$ = "Item 6"
lboxAddr.item7$ = "Item 7"
lboxAddr.item8$ = "Item 8"
wndPtr&=WINDOW(_wndPointer)
LONG IF wndPtr& <> 0
listH& = FN NEWCONTROL(wndPtr&,cntrlRect,"",_true,128,0,0,353,0)
osErr% = FN SetControlData (listH&,24,0,sizeof(listBoxContents),lboxAddr)
END IF
call disposeptr(lboxAddr)
END FN

local
DIM evnt%
DIM id%
LOCAL FN doDialog
evnt% = DIALOG(0)
id%   = DIALOG(evnt%)
SELECT CASE evnt
CASE _wndClose
END
END SELECT
END FN

FN buildWnd
ON DIALOG FN doDialog
DO
HANDLEEVENTS
UNTIL 0

'*************Resource ******************

(This file must be converted with BinHex 4.0)

:$QaLEhJZFR0bBb"MEh"j!(*cFQ058d9%!*!)!8dA``#3"!%!N!-"&J#3!aB!N!-
h!*$c%J!"!"X!!3!2!)`"!*!&!3#3!`%!N!-"&J#3!aB!N!-h"d6(G!$+!*!$(!!
b!!"XC'9c!*!$#J#!!*!'"d6'0!4XC'9cAr):

'*******************************************

Steve Van Voorst