Still going down the Lostfocus road - I like that as you either select a 
record by clicking on it, or abandon selection by clicking elsewhere. 
Realised my Lostfocus was on the wrong control! (ie the button, not the 
dListBox - changed my code as follows :-

  self.AccountLookupbtn = dabo.ui.dButton(self.basePanel, Left=184, Top=78, 
Width=40,
    Caption="Lookup",OnHit=self.DDLPanel)

 def DDLPanel(self, evt):
  self.fp = self.FloatingPanel
  # Can use floating panel owner property to set position here)
  left, top = self.Position
  self.fp.Position = (left+184,top+78)
  codes, keys = self.PrimaryBizobj.getAccountCodes()
  self.AccountCodeDDL = dabo.ui.dListBox(self.fp, Width=60, Height=200,
    Left=0, Top=0, ValueMode="Key", Choices = codes, Keys = keys, 
OnHit=self.DDLClick,
    OnLostFocus=self.DeleteDDL)
  wd, ht = self.AccountCodeDDL.Size
  self.fp.Size = (wd, ht)
  self.fp.Visible = True
  self.AccountCodeDDL.Visible = True

 def DDLClick(self, evt):
  self.PrimaryBizobj.moveToPK(self.AccountCodeDDL.Value)
  self.update()
  self.DDLKill()

 def DeleteDDL(self, evt):
  self.DDLKill()

 def DDLKill(self):
  self.AccountCodeDDL.release()
  self.fp.release()

Works correctly, but gives a trace as follows :

C:/Python25/pythonw.exe -u  "C:/LBProject/AccountsForm.py"
Traceback (most recent call last):
  File "c:\svndabo\dabo\ui\uiwx\dPemMixin.py", line 565, in __onWxLostFocus
    self.raiseEvent(dEvents.LostFocus, evt)
  File "c:\svndabo\dabo\ui\uiwx\dPemMixin.py", line 944, in raiseEvent
    super(dPemMixin, self).raiseEvent(eventClass, nativeEvent, *args, 
**kwargs)
  File "c:\svndabo\dabo\lib\eventMixin.py", line 93, in raiseEvent
    bindingFunction(event)
  File "c:\svndabo\dabo\ui\dDataControlMixinBase.py", line 53, in 
__onLostFocus
    if self._lostFocus() is False:
  File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 
13776, in __getattr__
    raise PyDeadObjectError(self.attrStr % self._name)
wx._core.PyDeadObjectError: The C++ part of the dListBox object has been 
deleted, attribute access no longer allowed.

Any suggestions?

Thanks          Rodgy


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/50956a973a2e4d87b2d93e71ab4bc...@roger

Reply via email to