From: Roger B. <ro...@ro...> - 2003-12-07 11:40:25
|
[2nd try - SourceForge is getting confused about my email address] Roger Binns wrote: >> You were initializing the combobox, but apparently it still didn't >> have a default selected item, which... causes a coredump on wxMac. ;-) > > 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. > > Roger |
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... -. ----. -.-- - -.-- |
From: Roger B. <ro...@ro...> - 2003-12-08 11:32:25
|
> If that were guaranteed to work, anyway, what is the point of this > statement later on? It would be redundant as you point out. > This was the whole point of my suggest changes... I was trying to figure out the minimal number of changes to make it work (ie finding exactly what was tickling the bug). I have just comitted another change which may also have contributed. Even though the CB_SORT flag was present, the choices were not being sorted on Linux. I have now removed that flag and pre-sorted the entries. Maybe it was the sort flag that was causing the crashes? > 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. Yup. However there are various little bugs on all the platforms that BitPim already works around. Once we are sure what the actual cause is and have reported it, whatever code works around it will be fine. Comboboxes obviously work on the Mac so it is some minor detail we do that the demos etc don't do. Roger |
From: Steven P. <n9...@n9...> - 2003-12-08 15:44:32
|
On Dec 8, 2003, at 5:32 AM, Roger Binns wrote: > I was trying to figure out the minimal number of changes to make it > work (ie finding exactly what was tickling the bug). Okay, I'll focus on that as a goal. > the entries. Maybe it was the sort flag that was causing the crashes? That has made no change here. > Comboboxes obviously work on the Mac so it is some minor detail we > do that the demos etc don't do. Can you please insert a check line? print "Selected = ", self.phonebox.GetSelection() I'd be curious to see what that does on a Windows or Linux install. I have a hunch that calling the GetValue() method for an undefined selection is not causing a coredump on Linux/Windows, but instead returns an empty string. Then, when you call SetValue(), everything is fine. I inserted the statement right above here: print "pb=",self.phonebox.GetValue() if self.phonebox.GetValue()=="": self.phonebox.SetValue("LG-VX4400") To test this theory, I inserted the line: self.phonebox.SetValue("LG-VX4400") right after the line where the box is created: self.phonebox=wxComboBox(self, -1, 'LG-VX4400', style=wxCB_DROPDOWN|wxCB_READONLY,choices=keys) And now it no longer crashes. To narrow it down, it would be helpful to know if Linux and/or Windows are properly setting the selection when the combobox is being initialized. If they are, then this is where the Mac is deviating. If they are not, then the error on the Mac would seem to be when the GetValue() method is called when the combobox selection is not valid. Make sense? -. ----. -.-- - -.-- Steve Palm - n9...@n9... -. ----. -.-- - -.-- |
From: Roger B. <ro...@ro...> - 2003-12-09 07:23:43
Attachments:
combobox.py
|
> I'd be curious to see what that does on a Windows or Linux install. I I have added a file as experiments/combobox.py that goes through all the possible variations. There is also a copy attached. This is the Windows output: cb1: GetSelection() = -1 cb1: GetValue() = '' cb2: GetSelection() = -1 cb2: GetValue() = '' cb3: GetSelection() = -1 cb3: GetValue() = '' cb4: GetSelection() = -1 cb4: GetValue() = '' cb5: GetSelection() = 2 cb5: GetValue() = '3' cb6: GetSelection() = -1 cb6: GetValue() = '' cb7: GetSelection() = -1 cb7: GetValue() = '' cb8: GetSelection() = 2 cb8: GetValue() = '3' This is the Linux output: cb1: GetSelection() = -1 cb1: GetValue() = '' cb2: GetSelection() = -1 cb2: GetValue() = '' cb3: GetSelection() = -1 cb3: GetValue() = '' cb4: GetSelection() = -1 cb4: GetValue() = '' cb5: GetSelection() = -1 cb5: GetValue() = '3' cb6: GetSelection() = -1 cb6: GetValue() = '' cb7: GetSelection() = -1 cb7: GetValue() = '' cb8: GetSelection() = -1 cb8: GetValue() = '3' Roger |
From: Steven P. <n9...@n9...> - 2003-12-09 14:04:32
|
On Dec 9, 2003, at 1:23 AM, Roger Binns wrote: >> I'd be curious to see what that does on a Windows or Linux install. >> I > > I have added a file as experiments/combobox.py that goes through all > the possible variations. There is also a copy attached. > > This is the Windows output: > > cb1: GetSelection() = -1 > cb1: GetValue() = '' > cb2: GetSelection() = -1 > cb2: GetValue() = '' > cb3: GetSelection() = -1 > cb3: GetValue() = '' > cb4: GetSelection() = -1 > cb4: GetValue() = '' > cb5: GetSelection() = 2 > cb5: GetValue() = '3' > cb6: GetSelection() = -1 > cb6: GetValue() = '' > cb7: GetSelection() = -1 > cb7: GetValue() = '' > cb8: GetSelection() = 2 > cb8: GetValue() = '3' > > This is the Linux output: > > cb1: GetSelection() = -1 > cb1: GetValue() = '' > cb2: GetSelection() = -1 > cb2: GetValue() = '' > cb3: GetSelection() = -1 > cb3: GetValue() = '' > cb4: GetSelection() = -1 > cb4: GetValue() = '' > cb5: GetSelection() = -1 > cb5: GetValue() = '3' > cb6: GetSelection() = -1 > cb6: GetValue() = '' > cb7: GetSelection() = -1 > cb7: GetValue() = '' > cb8: GetSelection() = -1 > cb8: GetValue() = '3' Mac Output: cb1: GetSelection() = -1 cb1: GetValue() = '' cb2: GetSelection() = -1 cb2: GetValue() = '' cb3: GetSelection() = -1 Segmentation fault -. ----. -.-- - -.-- Steve Palm - n9...@n9... -. ----. -.-- - -.-- |
From: Roger B. <ro...@ro...> - 2003-12-10 02:42:37
|
> Mac Output: > > cb1: GetSelection() = -1 > cb1: GetValue() = '' > cb2: GetSelection() = -1 > cb2: GetValue() = '' > cb3: GetSelection() = -1 > Segmentation fault Thanks for that. I have now passed it on to the wxPython maintainers and it is now their problem (tm) :-) I have also corrected BitPim so it should work fine and you won't get the coredump. Roger |