Contents:
Introduction
News blog
What is Servoy?
Getting Started
Comparison Servoy/VFP
Performance
How-To's
Code Reference
VFP2Servoy Toolkit
Contact / feedback
|
How to return a value from a modal dialog/popup form
To better understand what we're about to do you have to know that Servoy instantiates all forms at startup and shows/hides them appropriately.
That fact makes it very easy to return a value from a form because we can still talk to the form even after it has been closed.
All you have to do is create a form like you normally would. It doesn't matter if it's an edit form or a grid form. Then after a record has been selected we
ask the form for the value we need. Lets build a Customer listpicker form:
- First create a gridform (named customerGrid) with just a customer_id and a customer name. If you don't know how then do tutorial 10 first.
- Also create a simple testform with only a button on it. From this form we will popup the listpicker and show the selected value in a info dialog.
- In the onAction event for the button place the following code:
That's it! As you can see when you run the sample, after selecting a customer and closing the popup, code execution continues and we can simply ask the hidden form
for the customer name field which is still selected.
When you press the button again, and the popup reappears you will notice that the state of the form is as you left it, with the record pointer on the selected customer.
Note that there is also a showFormPopup method in the windows plugin that lets you return a value to a dataprovider in the calling form.
|
External resources:
vfp plugin
ServoyWorld 2012 pics
Official Servoy website
Ken Levy on Servoy
Servoy info
Servoy Forum
Servoy Documentation
|