// Clicking a list element causes it to be highlighted
// Double-clicking a list element causes it to beep.
// Assuming inclusion of
#include
#include < string.h>
void ToolBoxInit(void);
void ToolBoxInit()
{
}
main()
{
ListHandle myList;
short i, dummy;
long windSize;
short thePart;
ToolBoxInit();
myWindow = NewWindow(nil, &tempR, "\pList Mgr Demo", true, 0);
SetRect (&tempR, 0, 0, 380 -15, 250 -15); myList = LNew(&tempR, &dataBounds, cSize, 0, true);
cSize = (*myList)->cellSize; // Save cellSize so we can use
// it later to resize the cells
SetRect(&tempR, tempR.left - 1, tempR.top - 1, tempR.right + 16, tempR.bottom + 1);
for (i = 0; i < 20; ++i) {
s printf((char *)s, "Row #%d", i);
}
done = false;
screenBits.bounds.bottom - screenBits.bounds.top,
screenBits.bounds.right - screenBits.bounds.left);
while (!done)
switch (theEvent.what) {
case mouseDown:
& whichWindow);
switch (thePart)
{
case inContent:
theEvent.modifiers, myList);
if (beep)
break;
case inGrow:
theEvent.where, &sizeRect); if (windSize)
{
HiWord (windSize)-15, myList); cSize.h = LoWord(windSize)-15; }
break;
case inGoAway:
}
break;
if ((WindowPtr) theEvent. message == myWindow) { for (i = 0; i < 20; ++i) {
}
}
break;
}
}
}