PDA

View Full Version : Default toolbar in tabpanels



pdm
21 Feb 2012, 8:34 AM
I have a bunch of custom panels defined, and a tab panel that is filled with instances of my panels when the user clicks a menu.

I'd like each panel that opens to have a toolbar with some buttons on it with the same handlers each time, as well as it's own buttons and contents. How do I achieve this with Sencha Designer 2?

I'm enjoying the ease of Sencha Designer 2 beta so far!
thanks

aconran
21 Feb 2012, 10:06 AM
So you'd like the TabPanel to have a set of buttons that are always there but then within each specific tab add/remove additional buttons while keeping the set of buttons that tabpanel always has?

pdm
22 Feb 2012, 12:52 AM
yes, although I think it's more accurate to say I want the panels within the tabpanel to have a common set of buttons. If I wasn't using Designer I would probably add the buttons in the function when adding the panel to the tabpanel, but I'd like to be able to edit them visually and keep things wsyiwyg. I want to define all the panels with a common parent which I could then edit, and be able to edit the panels with the common buttons on them.

pdm
22 Feb 2012, 2:25 AM
I just tried creating a class, dragging it to the viewport and creating a link to it, which I thought might do the trick, but it created a duplicate which wasn't editable. This is probably a bug - but I'd rather it created another class extended from the first one than was prevented!

version 2.0-beta build 288

aconran
22 Feb 2012, 9:04 AM
I just tried creating a class, dragging it to the viewport and creating a link to it, which I thought might do the trick, but it created a duplicate which wasn't editable. This is probably a bug - but I'd rather it created another class extended from the first one than was prevented!

version 2.0-beta build 288

If you can reproduce this, create a separate thread in the bug forum and provide us the steps to reproduce so we can get it fixed.

aconran
22 Feb 2012, 9:05 AM
yes, although I think it's more accurate to say I want the panels within the tabpanel to have a common set of buttons. If I wasn't using Designer I would probably add the buttons in the function when adding the panel to the tabpanel, but I'd like to be able to edit them visually and keep things wsyiwyg. I want to define all the panels with a common parent which I could then edit, and be able to edit the panels with the common buttons on them.

The easiest way would probably be to add all of the buttons you want to the common toolbar in the tabpanel. Then based off of activate and deactivate events for the panels within the tabpanel I would show/hide the buttons you want or don't want.

pdm
22 Feb 2012, 9:33 AM
That's pretty good if my panels didn't have many things on them.

The problem is there's going to be maybe 5 buttons on every panel that need to do the same thing every time, and hundreds of panels with their own buttons.

Ideally I'd like to be able to design the 'parent' panel then later people will be able to independently make the individual child panels with their own form stuff and related, custom buttons in.

aconran
22 Feb 2012, 9:35 AM
Sure then add the common ones to the toolbar and dynamically add/remove them via source code.

pdm
23 Feb 2012, 1:08 AM
which toolbar? and what do you mean by 'via source code'? I'm not keen to make changes after building my project, as then I won't be able to go back to Designer later on and make edits to my project.

As a workaround, I can design both toolbars and have a function that removes one of them and adds it's contents to the other when the panel is added to the tabpanel. Unfortunately, this would only work at runtime, and not give my team a nice preview of the completed toolbar.