Update of /cvsroot/wnd/wnd/wnd/controls
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30587
Modified Files:
listbox.py
Log Message:
new message
Index: listbox.py
===================================================================
RCS file: /cvsroot/wnd/wnd/wnd/controls/listbox.py,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** listbox.py 29 Apr 2005 15:22:03 -0000 1.1.1.1
--- listbox.py 15 May 2005 09:25:28 -0000 1.2
***************
*** 25,30 ****
"""
-
from wnd.wintypes import (byref,
RECT,
INT,
--- 25,31 ----
"""
from wnd.wintypes import (byref,
+ Structure,
+ DWORD,
RECT,
INT,
***************
*** 44,50 ****
class ListboxMethods:
-
#-----------------------------------------------------------------
! # message handlers
def onMESSAGE(self, hwnd, msg, wp, lp):
--- 45,50 ----
class ListboxMethods:
#-----------------------------------------------------------------
! # message handler
def onMESSAGE(self, hwnd, msg, wp, lp):
***************
*** 55,68 ****
msgr.fReturn= 1
if msgr.msg==self.Msg.WM_COMMAND:
! if lp==self.Hwnd:
! notify = HIWORD(wp)
! if notify == self.Msg.LBN_ERRSPACE:
! self.onMSG(hwnd, "errspace", 0, 0)
! elif notify == self.Msg.LBN_SELCHANGE:
! self.onMSG(hwnd, "change", 0, 0)
! elif notify == self.Msg.LBN_SELCANCEL:
! self.onMSG(hwnd, "cancel", 0, 0)
return 0
elif msg==self.Msg.WM_SETFOCUS:
self.onMSG(hwnd, "setfocus", wp, lp)
--- 55,89 ----
msgr.fReturn= 1
if msgr.msg==self.Msg.WM_COMMAND:
! notify = HIWORD(msgr.wParam)
! if notify == self.Msg.LBN_ERRSPACE:
! self.onMSG(hwnd, "errspace", 0, 0)
! elif notify == self.Msg.LBN_SELCHANGE:
! self.onMSG(hwnd, "change", 0, 0)
! elif notify == self.Msg.LBN_SELCANCEL:
! self.onMSG(hwnd, "cancel", 0, 0)
return 0
+ elif msg==self.Msg.WM_STYLECHANGING:
+ # make shure LBS_MULTIPLESEL and LBS_EXTENDEDSEL
+ # can not be changed at runtime
+ # (will deadlock on some method calls)
+ if wp==(1l<<32) - 16: # GWL_STYLE
+ #LVS_SHAREIMAGELISTS = 64
+ sst = STYLESTRUCT.from_address(lp)
+ if sst.styleOld & 8: # LBS_MULTIPLESEL
+ if not sst.styleNew & 8:
+ sst.styleNew |= 8
+ elif not sst.styleOld & 8:
+ if sst.styleNew & 8:
+ sst.styleNew &= ~8
+
+ if sst.styleOld & 2048: # LBS_EXTENDEDSEL
+ if not sst.styleNew & 2048:
+ sst.styleNew |= 2048
+ elif not sst.styleOld & 2048:
+ if sst.styleNew & 2048:
+ sst.styleNew &= ~2048
+ return 0
+
elif msg==self.Msg.WM_SETFOCUS:
self.onMSG(hwnd, "setfocus", wp, lp)
***************
*** 75,79 ****
elif msg==self.Msg.WM_LBUTTONDBLCLK:
self.onMSG(hwnd, "lmbdouble", wp, lp)
!
#-------------------------------------------------------------------------
--- 96,102 ----
elif msg==self.Msg.WM_LBUTTONDBLCLK:
self.onMSG(hwnd, "lmbdouble", wp, lp)
! elif msg==self.Msg.WM_DESTROY:
! self.onMSG(hwnd, "destroy", 0, 0)
! return 0
#-------------------------------------------------------------------------
***************
*** 96,100 ****
if self.SendMessage(self.Hwnd,
self.Msg.LB_SETITEMDATA, result, lp)==LB_ERR:
! raise "could not set lparam"
return result
--- 119,123 ----
if self.SendMessage(self.Hwnd,
self.Msg.LB_SETITEMDATA, result, lp)==LB_ERR:
! raise RuntimeError, "could not set lparam"
return result
***************
*** 106,110 ****
if self.SendMessage(self.Hwnd,
self.Msg.LB_SETITEMDATA, result, lp)==LB_ERR:
! raise RuntimeError("could not setlparam")
return result
--- 129,133 ----
if self.SendMessage(self.Hwnd,
self.Msg.LB_SETITEMDATA, result, lp)==LB_ERR:
! raise RuntimeError("could not set lparam")
return result
***************
*** 161,166 ****
if not HIWORD(result):
return LOWORD(result)
!
!
def Select(self, i, stop=0):
--- 184,188 ----
if not HIWORD(result):
return LOWORD(result)
!
def Select(self, i, stop=0):
***************
*** 240,248 ****
def IterSelected(self):
! if self.GetStyleL('style') & self.Style.LBS_MULTIPLESEL:
n=self.SendMessage(self.Hwnd, self.Msg.LB_GETSELCOUNT, 0, 0)
if n:
arr = (INT * n)()
! self.SendMessage(self.Hwnd,
self.Msg.LB_GETSELITEMS , len(arr), byref(arr))
for i in arr:
--- 262,273 ----
def IterSelected(self):
! style= self.GetStyleL('style')
! if style & self.Style.LBS_MULTIPLESEL or \
! style & self.Style.LBS_EXTENDEDSEL:
!
n=self.SendMessage(self.Hwnd, self.Msg.LB_GETSELCOUNT, 0, 0)
if n:
arr = (INT * n)()
! r= self.SendMessage(self.Hwnd,
self.Msg.LB_GETSELITEMS , len(arr), byref(arr))
for i in arr:
***************
*** 454,457 ****
}
!
--- 479,484 ----
}
! class STYLESTRUCT(Structure):
! _fields_ = [("styleOld", DWORD),
! ("styleNew", DWORD)]
|