Callback System Search Panel!

addam davis
3 min readApr 18, 2022


Objective: Create a callback system!

At this stage of our app, we to be able to know if we found a successful case in order to change the next panel. If we successfully found a case, we want the “GetList” function to go ahead and load in. What if we could pass in a function into a parameter? That’s where delegates come in.

Delegates allow you to take a variable and treat it as a function. The call back system is similar to what we have been using as the “responsObjects To get started we need to navigate to our AWS class.

We are going to modify the “GetList” function to accept a call back. An Action is just a delegate that’s going to allow us to pass in some information.

After we have handled the “downloadedCase” part we are done. We know our case is complete and we should load the panel if we need to.

That’s going to trigger the code that we are going to pass into it as a parameter. We only want to call the “onComplete” method if we pass in something.

In search panel we can add the call back to the “GetList” function. What we want to do is when “GetList is called we want to load in the next panel.

We are going to pass in a function to turn it on. We are going to call a method to activate the select panel inside the “GetList” method using a Lambda. Lambda expression looks like (). It says, passing in no parameter because we are not requiring any. Then we go to => statement. When we call the “onComplete” method it’s going to run {} this code, whatever is inside the brackets.

This is a call back system. If we find a false case, nothing will happen. If we find a case, if you remembered to assign the panel, it will take you to the select panel.

Now we are ready to set up the select panel with the information from the downloaded case! I’ll see you in the next tutorial.