On Jul 21, 2010, at 7:49 PM, Bronwyn Woods wrote:

> I'm working with an App Wizard application.  I have a grid on form A that
> lists some of the records associated with form B.  When the user clicks on a
> grid row, I would like to open or switch focus to form B's edit page for
> that record.  By using the show() method as done for the file-open menu, I
> can successfully open the appropriate form.  However, I have two questions.
> 
> 1. If I click on a row twice, form B opens twice.  If a form is already
> open, is it possible to just switch focus to that form instead of opening it
> again?  I've tried a few of the dForm properties that looked like they might
> be appropriate but have had no luck.

        I would store a reference to form B on form A, and try to use that if 
possible. The code to show form B would look something like:

try:
        self.formB.show()
except AttributeError:
        self.formB = MyFormBClass()
        self.formB.show()

        Additionally, I would add buttons to dismiss form B that only call 
self.hide() instead of self.release(); this way the next time the form is 
needed, the same form can be re-used.

> 2. How to I tell form B to show the edit screen for the record selected in
> form A (instead of the default grid page)?

        I'm guessing from your description that both forms A&B are 
AppWizard-generated forms. This is when AppWizard starts to lose its advantage, 
as it wasn't designed to work the way you're trying to make it work, and as a 
result you're going to have to spend some time coding around the intended 
design. I'd change the code above to look more like this:

try:
        self.formB.pageFrame.SelectedPageNumber = 2
except AttributeError:
        self.formB = MyFormBClass()
        self.formB.pageFrame.SelectedPageNumber = 2
self.formB.update()
self.formB.show()

        This will set the selected page to the edit page, update its controls 
with the current bizobj record, and then show the form.

        I hope this helps!


-- Ed Leafe



_______________________________________________
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]

Reply via email to