Contents:
Introduction
News blog
What is Servoy?
Getting Started
Comparison Servoy/VFP
Performance
How-To's
Code Reference
VFP2Servoy Toolkit
Contact / feedback
|
How to add a commandbutton to a form
Adding a commandbutton to a form from the toolbar won't be a problem because it works the same as in Visual FoxPro.
However, when you doubleclick the button don't be surprised. Doubleclicking it enables you to fill the text property
and does not open a code window as in VFP.
So where do we put the Click event code? What you should know is that Servoy does not store object code in the objects themselves but
puts them in a formbound procedure file which has the same name as your form and the extension (".js"). Maybe you
remember it because that's also where the form variables (VFP: form properties) are stored.
So let's say we want to build a Hello World sample, how do we do that? Take these steps:
- Create a new form or open an existing form
- Click the commandbutton icon on the toolbar
- Doubleclick the commandbutton and enter the text property (VFP: caption)
- In the property sheet locate the onAction event
- Doubleclick the value part of the onAction event
The following dialog appears:
- Press the Create Form Method button
- Choose a name for the method (ie: button_click)
- Press Ok
- Press Ok again. The method has been created and bound to the onAction event of the commandbutton
The method (in VFP we would call it a function) has been added to the previously mentioned procedure file. The file
has been opened as a tab in your form design area. Click it and inspect the code. The blue header part is generated by Servoy
and shouldn't be altered. As you can see a TODO placeholder has been added to the new method. TODO placeholders appear on the
TODO window so you know you still have some work there (.Net has this feature as well).
Now add the code for greeting the world and run the form. That's it!
Properties/Events/Methods
|
External resources:
vfp plugin
ServoyWorld 2012 pics
Official Servoy website
Ken Levy on Servoy
Servoy info
Servoy Forum
Servoy Documentation
|