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 combobox to a form



So far we've added controls that are relatively simple to use. How about the combobox? The combobox can be a bit of a pain in VFP (BoundTo, BoundColumn, ColumnCount, ColumnWidths, ControlSource, DisplayCount, DisplayValue, FirstElement, RowSource, RowSourceType etc.). Adding it to a gridcolumn can also be troublesome. None of this in Servoy. Just plain and simple, the way we like it!

 

The combox is a valuelist control. If you have not yet read about the valuelist then do so first because you need one as a datasource.

 

The beauty off the valuelist is that it doesn't matter if at first you decide you want to hardcode some custom values in a valuelist and bind it to your combobox but later decide to put them in a table. All you have to do is change the valuelist! All controls that use the valuelist remain unchanged!

 

To add a working combox to your form do the following:

 

  • Create a valuelist as described in the corresponding walkthroughs
  • Click the textbox icon on the toolbar or add a field from a table to a form

 

select a dataprovider

 

In the screenshot above the countryfield is selected as the dataprovider, in VFP this would be the BoundColumn. After pressing Ok a textbox control is added. But that's not what we want!? Don't worry:

 

  • Change the displayType property of the textbox and set it to COMBO
  • Set the horizontalAlignment property to LEFT
  • Select the valuelist property and doubleclick it
  • From the dialog select the valuelist you created earlier

 

select the valuelist

 

Did you notice that when you changed the displayType, the textbox turned into a combobox but a white one and not a grey one? Once you selected the valuelist however it was colored in. This is a visual hint to help you not forget to select the valuelist.

 

the result

 

 

Conclusion

Once you grasp the concept of the valuelist and applied it several times you start to realize what a monstrous timesaver this is going to be. And all of this without any code whatsoever! (from your part anyway)

 

 

External resources:

 

vfp plugin

 

ServoyWorld 2012 pics

 

Official Servoy website

 

Ken Levy on Servoy

 

Servoy info

 

Servoy Forum

 

Servoy Documentation

 

VisualFoxpro.com © 2010-2012 • All rights reserved • Contact: info@visualfoxpro.com