On 3/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Thanks for everyone's help, my little application is coming along with speed. > > However, I've hit a more complex problem. > > I have a tabbed panel, with the first page containing a set of > controls that let me set the criteria for a search. The panel > containing these controls is going to get a reg id, so I can easily > access the currently selected criteria from anywhere (way cool- > 'globals' done right ;-) ) > > The second page contains a panel, with a vsizer, lets call it viewerSizer. > In the first (and at design-time, only) slot is a panel, which > contains what I'm sure is a common dabo pattern: > The panel contains a splitter, with a grid on the left, and a bunch of > controls on the right. > The grid and controls are tied to the same bizObj. Select a row in > the grid, and the controls on the right update with the contents of > that row from the bizObj data source. > The panel will contain a button 'update constraints'- it'll get the > values from the controls accessible via the reg id mentioned above, > and will then update the constraints on the bizObj data source, and > then cause a requery. I think this should make everything update > nicely. > Let's call it viewerPanel. > > Now the tricky part. > I want to add another button to the above panel, 'create new viewer panel'. > This should set up another instance of viewerPanel, and append it to > viewerSizer. > The tricky part for me: this should have different constraints than > the first instance. > I should be able to go to page 1, change the constraint settings, go > back to page 2, and neither viewerPanels should have changed. > If I click on the 'update constraints' button on the first viewerPanel > instance, only it should update (with the new constraints.) > Same thing for the second instance. > > Do I need a bizObj/viewerPanel? > If so, should I create it in beforeInit of the panel? > And, is there a shorthand way to update the datasource on all the > contained controls in the panel? (Not that looping is too difficult > :-) ) That could go in afterInit, correct? > > Any suggestions how I should structure this appreciated!
Use the class designer or favorite text editor to create your vewierPanel class. Make sure that you put the "create new viewer panel" button in. Save that class. Store a reference to viewerSizer in the class so you can append stuff. Include an event handler like this: def onHit_viewButton(self, evt): newViewPanel = viewPanel(self.Parent, etc.) self.viewerSizer.append1x(newViewPanel) That solves your creation problem. If you want to not display the create panel button anymore just set self.viewButton.Visible to False. Now for the updating part. I assume that when update constraints is displayed you want to update various controls on various panels. The class should have an update method that will query bizobj's and update the data that is called by the onHit_udateButton function. That's all fine and dandy, but we still need a way of updating the other objects. The most elegant way of doing this in my opinion is to implement the viewPanel class as a borg DP. The shared state would be a list of viewPanels created. Each class upon instantiation will add itself to the list. On updating, a function can cycle through the list and update all of the panels. Hope this helps, let me know if I need to explain something better. Cheers, Nate L. > > Thanks > > Julian > > _______________________________________________ > Post Messages to: [email protected] > Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users > _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
