Converted to Appearance and using a List control in stead of manually creating the List and putting it in a useritem. The old version is in oldPICTbrowse, for documentary purposes.
diff --git a/Mac/Demo/PICTbrowse/ICONbrowse.py b/Mac/Demo/PICTbrowse/ICONbrowse.py
index c4f945b..f5ea93b 100644
--- a/Mac/Demo/PICTbrowse/ICONbrowse.py
+++ b/Mac/Demo/PICTbrowse/ICONbrowse.py
@@ -5,6 +5,7 @@
import Res
import Qd
import Win
+import Controls
import List
import sys
import struct
@@ -119,11 +120,11 @@
self.id = id
FrameWork.DialogWindow.open(self, ID_MAIN)
self.wid.SetDialogDefaultItem(MAIN_SHOW)
- tp, h, rect = self.wid.GetDialogItem(MAIN_LIST)
- rect2 = rect[0]+1, rect[1]+1, rect[2]-17, rect[3]-17 # Scroll bar space
- self.list = List.LNew(rect2, (0, 0, 1, len(contents)), (0,0), 0, self.wid,
- 0, 1, 1, 1)
self.contents = contents
+ self.ctl = self.wid.GetDialogItemAsControl(MAIN_LIST)
+ h = self.ctl.GetControlDataHandle(Controls.kControlListBoxPart,
+ Controls.kControlListBoxListHandleTag)
+ self.list = List.as_List(h)
self.setlist()
def setlist(self):
@@ -139,13 +140,6 @@
self.list.LSetDrawingMode(1)
self.list.LUpdate(self.wid.GetWindowPort().visRgn)
- def do_listhit(self, event):
- (what, message, when, where, modifiers) = event
- Qd.SetPort(self.wid)
- where = Qd.GlobalToLocal(where)
- if self.list.LClick(where, modifiers):
- self.do_show()
-
def getselection(self):
items = []
point = (0,0)
@@ -165,21 +159,10 @@
for resid in selection:
self.parent.showICON(resid)
- def do_rawupdate(self, window, event):
- tp, h, rect = self.wid.GetDialogItem(MAIN_LIST)
- Qd.SetPort(self.wid)
- Qd.FrameRect(rect)
- self.list.LUpdate(self.wid.GetWindowPort().visRgn)
-
- def do_activate(self, activate, event):
- self.list.LActivate(activate)
-
def do_close(self):
self.close()
def do_itemhit(self, item, event):
- if item == MAIN_LIST:
- self.do_listhit(event)
if item == MAIN_SHOW:
self.do_show()