#List in Dialog
20-Jul-93 04:01:25
Sb: #7179-#List in Dialog
Fm: Steve Stockman 76507,2646
To: Darren Williams 100033,1730
Darren:
I think the example in Think Ref is bad. In main(), item 3 is set to be a
userItem with draw procedure UserProc. In UserProc(), the list is built and
drawn into the rectangle properly, and then item 3 is set to be a userItem with
draw procedure theList (???). But theList is a ListHandle!
Your crash is occurring when the dialog is moved or obscured because the Dialog
Mgr tries to update it, including calling the userItem procedure, which happens
not to be a procedure in this case. Illegal instruction is not a surprise.
Instead, when creating the dialog, go ahead and build the list right then,
saving the ListHandle in a global, and set the item to userItem with a draw
procedure that does nothing but GetDItem() / FrameRect() / LUpdate(). If the
item rect is fixed or in a global, you don't even need the GetDItem.
The first call to ModalDialog will force the update, and the list will be drawn
properly and remain stable.
Steve