How to detect a tap on a WKInterfaceGroup added within a table row controller? - watchkit

So this is my InterfaceController hierarchy:
-> InterfaceController
-> Table
-> RowController
-> Group A
-> Group B
-> Gesture
I've also implemented override func table(_ table: WKInterfaceTable, didSelectRowAt rowIndex: Int) {...} of WKInterfaceTable where I'm receiving the selection of a row controller. However, I'm not receiving the touch event (a tap event) on Group B.
I've attached an IBAction with the tap gesture which should get call when I taps on the Groupp B. if I tap outside (means, on Group A) then it should call the table's didSelectRowAt: method but right now, it's not calling gesture's action.
Any other solution to implement this?

Temporary I've implemented this by replacing Group B with a WKInterfaceButton. So now, I can detect the button touch as well as table's didSelectRowAt:. I will wait for a perfect solution to this problem.

Related

How to make an action connection for multiple buttons in xcode10?

I am wondering how do we make an action connection for multiple buttons in Xcode10. Just ONE CODE for ALL buttons.NOT SEPARATE.
For example, we have 7 music key buttons, and we want to make one action connection for all 7 of them, and then continue to code to make the code know which key is being exactly pressed. As the code that I posted in this question, how do we make " #IBAction func notePressed(_ sender: UIButton)" this line? Not by typing, by clicking and dragging.
Another example is, we have "true" and "false", two buttons. We want to make just one action connection for these two buttons in ViewController.swift.
I know how to make one action connection for a single button, but when it comes to multiple buttons, I do not know how to do. I use xcode10
I have tried to hold the command and select all the buttons at the same time, and then hold the control key and try to drag all the buttons from the mainStoryBoard to my swift code, but it seems that I only created an action connection for on button in this way.
#IBAction func notePressed(_ sender: UIButton)
{
let selectedNote : String = soundArray[sender.tag - 1]
playSound(inputNote : selectedNote)
}
If you find the connected actions part in the First Responder part in the storyboard, you are able to connect it one by one as the screenshot.

making multiple http call after Switching between components

I have one query which is bit complex for me to explain but do ask me if you need any further details...
Angular version: 8.
Subject : issue while Switching components is circular.
Like from Component A. -> B -> A -> B
Brief details of my problem
From 'A' component I have selected couple of employees then click on the apply filter button so that I can switch to B component.
On every employees check-box clicked emitting event using service so that from 'B' component I should be able to fetch those selected employees and do further logic (like. API call)
Switching from A to B is working as expected because based on selected employees I am hitting the API to get their details.
But to reset the selected employees I am redirecting back to A component so that I can add more or remove employees...
Now the problem what I was facing is
As I have logic in component B, to hit the API and get the employees details.
The problem is after one round back from component 'B' on every selection one hit goes to API to get updated emp details.
I know it's happening bcz of EvenEmitter but what is the best possible solution for this so that on every event emit it should not make API call from 'A' untill and untill I am not in component B.
I have fixed my problem.. every time when we redirect to other route it will automatically call the ngOnDestroy where you can unsubscribe all the services that you have subscribed.
Syntax to unsubscribe:
Declare one property
ServiceSubscriptions: Subscription;
ngOnDestroy() {
this.ServiceSubscriptions.unsubscribe();
debugger;
}
Feel free to ask me if anybody has any query.

JavaFX - How to use multiple same type of event handlers on a single node

I've got 2 ListViews (A and B) of the same base type. What I need to implement is:
- user drags items from A, drops them into B
- user drags items from B, drops them into B(rearrangement).
The changes has to be saved in an sqlite table. 2 different sql query runs, so the drag and drops must have a different outcome.
If I do 2X B.setOnDragDropped, can I differentiate the 2 depending on where did the drag start?
Thanks for your help, much apprich folks
If you call setOnDragDropped(...) twice on the same node, the second handler will replace the first one (it is a set method, and works the same way as any other set method: it sets the value of a property).
You need something along the lines of
listViewB.addEventHandler(DragEvent.DRAG_DROPPED, e -> {
// handler code here...
});
You can determine the source of the drag inside the handler with
e.getGestureSource()
and see which node it matches to determine the course of action.

Conditional commands

I have three main views in my application: A, B and C. Each of these views contain a view called X. Clicking a button in the X view dispatches a FooEvent to the event pool.
I would like to map multiple commands to the FooEvent and execute one of them depending on which main view (A, B or C) is currentry visible. I would have to add an if clause to every command mapped to FooEvent checking if the correct view is visible and I don't like this. Distributing logic across commands makes them hard to manage.
What is the best way to conditionally call commands in the context my application?
Inside X mediator you can create a listener for a FooEvent.
and then based on X parent you dispatch new Event.
Or inside A,B and C you listen for FooEvent, and when you catch it you mediate it from A,B or C mediator to specific command.
The goal is to keep view events inside views, and to mediate new communication further
You can also use Signals

How can fragment pass data to calling fragment

I have an activity with two fragments say F1 and F2. On clicking the list view of F2 , a new fragment is called say F3 (Its single activity multi fragments design).
I have back button on right side of dual pane layout. On hitting this button i need to pass data from fragment F3 to F2, so that F2 views are updated based on data received(something like onActivityForResult for activity to activity interaction).
How can i achieve this?
Fragment class has setTargetFragment(), according to docs:
Optional target for this fragment. This may be used, for example, if
this fragment is being started by another, and when done wants to give
a result back to the first. The target set here is retained across
instances via FragmentManager.putFragment().

Resources