Mike Mabey wrote:
> On Thu, Aug 21, 2008 at 2:54 PM, Paul McNett <[EMAIL PROTECTED]> wrote:
>> You must be trying to set radiolist.Value = "1" somewhere. Or, the field
>> in the table that is the source of the data has a value of "1" as the
>> field. And perhaps that is happening before the Choices/Keys have been
>> entered?
>
> I've looked through my code and made sure that I'm not setting the radio
> list's value anywhere, and I'm still getting that error. In fact after
> cleaning up one section of code to be more Pythonic, I'm getting the error
> two or three times before the app fully initializes:
>
> Dabo Error Log: Thu Aug 21 15:16:21 2008: No radio button matching '1' was
> found.
> Dabo Error Log: Thu Aug 21 15:16:30 2008: No radio button matching '0' was
> found.
>
> If it would help for me to post my .cdxml file and my *-code.py file, I
> will.
Actually, the answer is in the snippet you post below:
> Here's the section of code for the radio list straight from the cdxml file:
>
> <dRadioList code-ID="dRadioList-dPanel" sizerInfo="{'HAlign': 'Center'}"
> Orientation="Horizontal" Caption="Level" Value="1" Choices="['1',
> '2', '3', '4']" Width="125"
> designerClass="controlMix" DataField="level" RegID="LevelField" Height="35"
> DataSource="categories"></dRadioList>
>
> This is the code as generated by the ClassDesigner. I've tried changing
> ' to ' a few times with no change in behavior.
Here's the equivalent python that will help unravel the issue (actually,
Ed, please review, as I'm confused that some attributes seem to not
require embedded ' and others do. Specifically, is Value evaluated
to a string or an int?):
class dRadioList-dPanel(dabo.ui.dRadioList):
def initProperties(self):
self.RegID = "LevelField"
self.Caption = "Level"
self.Orientation = "Horizontal"
self.Choices = ["1", "2", "3", "4"]
self.DataSource = "categories"
self.DataField = "level"
self.Width = 125
self.Height = 35
self.Value = 1
Okay, all the controlitem classes such as dRadioList default to a
ValueMode of 'string'. This means that if you set radio.Value = "1"
given the above example, the first button (position of 0) should be
checked.
However, you appear to be setting the Value to 1 (an int) and not "1" (a
string). I'm not sure if this is due to you or the Class Designer though.
Can you try changing Value to "1"? Failing that, can you set ValueMode
to "position" and set Value to 0?
>> I'm sure there's a good reason for your problems saving. So you do a
>> form.new() and enter values, and then form.save() and nothing is saved?
>> Is a blank new record saved?
>>
>>
> Okay, so this was one thing I didn't know before. I had just assumed that I
> could leave all the controls empty and they would be ready to accept values
> for a new record, since the app is strictly for adding new entries and not
> editing or viewing, so the form never does a requery(). So I added
> self.new() to the form's afterInitAll() method, and the new record now shows
> up in the database after a save() in the app.
Cool. Yes, without that new() there isn't a new record to add to.
> So at this point I've made good progress, and I've been able to get rid of
> all errors except for the one listed above.
Let us know how it resolves!
Paul
_______________________________________________
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/[EMAIL PROTECTED]