Contents:
Introduction
News blog
What is Servoy?
Getting Started
Comparison Servoy/VFP
Performance
How-To's
Code Reference
VFP2Servoy Toolkit
Contact / feedback
|
How to create and use a valuelist with custom values
Custom Values
Maybe you have tried to turn a textbox into a radiobutton but didn't succeed. That's because you didn't
know about valuelist's yet. Suppose we want to make a radiobutton with which the user can select the
customers gender (male/female) and store the selected value in a character field in the main table.
Do the following:
- Locate the Valuelist node in the Solution Explorer and right-click it
- From the popup select Create Valuelist
- Give the valuelist a name (ie Gender)
- Select Custom Values option (it is selected by default) in the dialog that appears
- In the custom values editbox enter male and female on seperate lines
- Close the valuelist dialog and save the changes
- Add a textbox to a form (bound to a character field in a table as you have learned)
- From the valuelist property of the textbox select the Gender valuelist
- Resize the radio control (vfp: optiongroup) to accomodate the available choices
- Set the horizontal alignment to LEFT
Custom Value with numeric ID
In the sample above we stored the character value of either male or female in the database. In
many cases however we would store a numeric value of 1 or 2 instead. Of course Servoy supports this
and makes it real easy too. As you see in the screenshot below, all you have to do is include the numbers
and seperate them from the character values by a pipe "|" symbol. And of course bind the control
to a numeric field.
|
External resources:
vfp plugin
ServoyWorld 2012 pics
Official Servoy website
Ken Levy on Servoy
Servoy info
Servoy Forum
Servoy Documentation
|