13 Jun 2012 2:23 PM #1
Controller not getting events
Architect Build tested:
- Build: 442
- Touch 2.x
- I'm not sure what I did, but nothing reaches the controller no matter what I do.
- Each button has an itemID. I have 16 buttons on the page (simulating a phone keypad panel 1-0,*,#, CONTACTS, SEND, DELETE. [i]-- I thought the itemID would give me the xtype
- Possibly deep nesting of buttons in containers.
- Possibly during project changes something was lost.
- Possibly After adding event binding to one of the buttons, the rest of the buttons don't reach the controller.
- Tried in a new project with itemID and then with ID
- Try all possibilities
- Start from these: [**] cntrl:kbController, with controller action for Ext.Button Tap event. console.log("kbController: button tapped");[**] Deeply nested view:mainTabPanel / tab: keypad / kbPanel / kbTop + kbGrid[**] kbGrid: / kbPanelRowA: kbBtn1,kbBtn2,kbBtn3; / kbPanelRowB: kbBtn4, kbBtn5, kbBtn6 Note: I figured that the itemId is what I set, so that I get the xtype.And that the itemId would be caught by the controller as the id to look for[**] In the controller action selector try: 'kbBtn12, or 'button kbBtn12' or just 'button'[**] In the kbBtn2 add Id 'kbBtn2' and in selector try: '#kbBtn2'[**] Add an event binding to kbBtn1 for Tap: console.log("btn 1 tapped")
- Preview in chrome, hit ctrl-shift-i to see console.
- console to show: 'kbController: button tapped'
- console only shows the kbBtn1 tap if defined
Screenshot, Project, or Video:
- not attached
- not provided
- Win7 and WinXP pro in Preview on Chrome
14 Jun 2012 7:33 PM #2
Can you share your controller code so I can get a better sense for what your trying?Phil Strong
15 Jun 2012 5:38 AM #3
The controller code is simply a BUTTON TAP controller action
tried different selectors, and none worked.
The code is:
It seems the kbButton1 with an event binding added action in the VIEW:
15 Jun 2012 5:48 AM #4
So instructions to reproduce are simpler:
In Architect 2:
MainView with two buttons.
In itemId set to kbBtn1, and the second button's itemId to kbBtn2
On the first button add Event Binding / basic event for TAP
Make a Controller and add Actions / Controller Action for button TAP
The bug occurs.
Try changing the Controller action's selection: to button. or to kbBtn2 and it won't work.
18 Jun 2012 7:07 AM #5
Ok so I am able to get it work and I suspect it's because of one thing
1. create a new touch project
2. add a form panel
3. add 2 buttons
itemId: kbBtn1 and kbBtn2
4. add a basic event binding to kbBtn1 (config pane, click + next to events, choose basic, and select tap event)
5. double click tap onkbBtn1Tap (to edit)
6. add the following code
console.log('normal button tap');
8. add MyFormPanel1 as a view of the controller and select remove (either choice would be fine here)
9. add a controller action to MyController
10. targetType: Ext.Button, name: tap (should fill in controlQuery: button, fn: onButtonTap1 for you)
11. edit tap onButtonTap1 controller action and add the following code
console.log('controller action tap');
Preview it from a web server e.g. http://localhost/sandbox/pashute/app.html
Click on button1:
controller action tap app/controller/MyController.js?_dc=1340031614578:31
normal button tap app/view/MyFormPanel1.js?_dc=1340031614583:42
Click on button2 2 times:
2 controller action tap app/controller/MyController.js?_dc=1340031614578:31Phil Strong
20 Jun 2012 3:23 AM #6
So your saying that the missing thing here is that I did not add the MyFormPanel1 in the controller Views ?
But when I do that, it says: MyFormPanel1 is already defined. Do you wish to replace it? or something like that...
21 Jun 2012 10:45 AM #7
Yeah that's ok it's asking if you'd like to continue including it in application or not. Typically you would not but choosing to keep it at the app level won't hurt anything