>Ed Leafe wrote:
>> On Apr 29, 2007, at 3:43 PM, [EMAIL PROTECTED] wrote:
>> * Creating a toolbar:
>> I've shamelessly ripped some code of the datanav subframework to  
>> create a toolbar :-). I've used the form.afterInit method to create  
>> it. I wonder if this is the best place to do it, or if there is  
>> another place that makes more sense to put UI creation/changing code?
>
>As long as that works, there should be no problem.

Good to know.

>>> * onNew:
>>> I'm looking for a way to create a new record depending on which  
>>> page is Showing on a PageFrame. One as a list of books another as a  
>>> list of authors. Both lists have a RegID and both are associated to  
>>> bizObjs. Because I want to do this from the toolbar, I'm thinking  
>>> to override the form's onNew method, but am not sure how to test  
>>> for the current selected page and how to use the onNew method. In  
>>> pseudo-code:
>>>
>>> def onNew(self, evt):
>>>     if self.pgBookLst.Shown:
>>>         getBizobj('book').new()
>>>     elif self.pgAuthorLst.Shown:
>>>         getBizobj('author').new()
>>
>>      Use the pageframe's SelectedPage property to determine which page is  
>> shown.
>>

Ups! The pseudo-code is working just fine all it needed was an extra line 
calling the refresh method of each grid so as to update the ui.

On the other hand how do you propose that the pageframe's SelectedPage property 
would be used. Something like this or do you have something else in mind:

def onNew(self, evt):
    # not using any RegID's for the Pages
    # using RegID's for the grids
    pg = self.dPageFrame.SelectedPage
    if pg.Name == "pgAuthorLst":
        self.getBizobj('author').new()
        self.grdAuthorLst.refresh()
    elif pg.Name == "bookLst":
        self.getBizobj('book').new()
        self.grdBookLst.refresh()

The only differences I see with this approach are:
* not using any RegID's for the Pages
* using RegID's for the grids

Is there any real difference between one method and the other?

>>> Because the bookBizobj is the form's primary bizObj I wonder if I  
>>> could just return True or somehow evt.Skip() to let the default  
>>> behaviour of record creation take place for the case where  
>>> pgBookLst is visible?
>>
>>      While that might work, it's better to be explicit than implicit.

Good point! Never argue against the Python Mantra ;-)

>>
>>> * onSave:
>>> Up until now I've managed to create a record, but haven't figured  
>>> out how to save it. dabo asks me to commit the record uppon  
>>> aplication close. But I really would like to figure out how to do  
>>> it automatically (sometimes we don't want user confirmation) and  
>>> also how to have a Save button.
>>
>>      The form's save() method will save the current bizobj's changes. You  
>> can also use save("author") to save changes to the author bizobj.

Once again thanks.
Miguel

_______________________________________________________________________________________
Aqueca o seu Inverno com o credito pronto a usar!
Saiba mais em http://www.iol.pt/correio/rodape.php?dst=0701181



_______________________________________________
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/dabo-users/[EMAIL PROTECTED]

Reply via email to