From: Steven P. <n9...@n9...> - 2003-12-07 14:45:26
|
On Dec 7, 2003, at 5:34 AM, Roger Binns wrote: > Ok, the root cause would appear to be that the combobox is > readonly, and the default value supplied is not in the list > of choices. Try this as the line instead (uses LG-VX4400 as > the value). > > self.phonebox=wxComboBox(self, -1, "LG-VX4400", > style=wxCB_DROPDOWN|wxCB_READONLY|wxCB_SORT, > choices=self.phonemodels.keys()) > > I have committed it as that. ...and I still get a segfault. If that were guaranteed to work, anyway, what is the point of this statement later on? print "pb=",self.phonebox.GetValue() if self.phonebox.GetValue()=="": self.phonebox.SetValue("LG-VX4400") Basically, aren't you saying... If no choice was made, set it to the LG-VX4400. But if you are initializing that with the default choice, why is this necessary? If i put in something like: print "Selected Item: ",self.phonebox.GetSelection() right before the print "pb=" line, it still returns a -1 which shows that nothing has been selected, and therefore the call the self.phonebox.GetValue() causes the segfault becuase there is no default selected item to get a value from. This was the whole point of my suggest changes... When it arrives at this point, much like you were checking and setting a value if one did not exist, I was checking for and setting the selected item if one did not exist. I simply chose the first one in the list, but if you'd rather code in the index for the LG-VX4400 that is fine. I think this is clearly a bug in the wxMac implementation, because the default selected item *SHOULD* be properly set with the code you are using. However, reality is that it is not being set. Sorry for rambling. I guess either a mac-specific workaround can be put in the code here, or else someone will have to submit a bug to the wxMac group and wait it out. -. ----. -.-- - -.-- Steve Palm - n9...@n9... -. ----. -.-- - -.-- |