I'm using the code from the dComboBox.py to create a jKey type of control.  I 
am very close to having everything working.  But I can not catch the detele 
key in my code (see below) and I can't determine the cause.  This is on 
windows with the latest svn (have not checked Linux).

I import dKeys and I'm checking to see if the evt.keycode =dKeys.key_Delete.  
However, the key stoke never gets to the code.  The  "dKeys.key_Back" get 
there so I sure I'm not doing anything to stop it.  I think something in Dabo 
is stopping the delete key and the reason I'm posting in dev-list.  I also 
can't see the delete in the dComboBox code.

def jKey(self,evt):
                self.mytimer.start()
                if not self:
                        # The control is being destroyed
                        return
                keyChar = evt.keyChar
                print evt.keyCode
                if evt.keyCode in (dKeys.key_Back, dKeys.key_Delete,  
dKeys.key_Left, 
dKeys.key_Numpad_delete, dKeys.key_Home):
                        keyChar=''
                        choiceStr=self.Choices[self.GetSelection()]
                        themarks=self.GetMark()
                        self.localString=choiceStr[themarks[0]:themarks[1]]
                        if len(self.localString) > 1:
                                self.localString= self.localString[:-1]
                                
                if keyChar is not None and (keyChar.isalnum() or 
keyChar.isspace() or 
keyChar=='' 
                                or keyChar in """,./<>?;':"[]\\{}|[EMAIL 
PROTECTED]&*()-_=+"""):
                        localStr= self.localString+keyChar
                        #if evt.EventObject.Value is not None:
                                #txt =evt.EventObject.Value+keyChar
                        #else:
                                #txt=keyChar
                        
                        findcntr = 0
                        foundOK=False
                        for i in self.Choices:
                                
                                if re.match('^'+localStr.upper(),i.upper()) is 
not None:
                                        self.PositionValue=findcntr
                                        #self.SelectAll=False
                                        #self.InsertionPoint=len(txt)
                                        self.select(1, len(self.localString))
                                        self.SetMark(0,len(localStr))
                                        
                                        self.localString=localStr
                                        foundOK=True
                                        
                                        break
                                findcntr=findcntr+1
                        if not foundOK:
                                dabo.ui.beep()
                                self.SetMark(0,len(self.localString))
                                
                        evt.stop()
-- 
John Fabiani


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]

Reply via email to