Browse DevX
Sign up for e-mail newsletters from DevX


Controls, Events, Commands, and More : Page 5

Dive right in to Visual FoxPro 9.0's new properties, events, and methods; new or improved commands; and FoxPro Foundation Classes (FFCs).




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Collection Object Support in ComboBox and ListBox Controls
The RowSourceType property on ComboBox and ListBox objects has a new option added to the list of possible sources: value 10, for the Collection object.

A collection could be populated with Business objects or objects holding some sort of data, and that Collection can be used to populate ComboBoxes and ListBoxes. The following code snippet shows an example of that, using a collection named colEmployees contained in the form, and the ComboBox's RowSourceType property is set to 10.

Select EmployeeId, FirstName; from employees into cursor curTemp Scan Local loEmployee as Object Scatter NAME loEmployee Blank Scatter NAME loEmployee additive This.colEmployees.Add(loEmployee,; Transform(loEmployee.EmployeeId)) EndScan This.cboEmployees.RowSource =; "Thisform.colEmployees, FirstName, EmployeeId"

Rotating Label, Line, and Shape Controls
Figure 2. The AutoHideScrollbar Property: The ListBox's AutoHideScrollbar property provides several useful options.
For a long time now, Visual FoxPro developers have waited for the capability to rotate labels. The option is now available through a new Rotation property, which receives a number indicating the degrees the control will rotate. The Rotation property is also available for Line and Shape controls.

ListBoxControls Can Hide ScrollBars
A new AutoHideScrollbar property was added to the ListBox class. This property determines whether or not the ListBox shows the scrollbar at all, and whether it is shown if the control only has a few entries.

If the default value 0 is used, the scrollbar is always visible, while a value of 1 determines that the scrollbar is only visible when the ListBox is full. This makes a lot of sense, as a scrollbar is of no use when all the items on the ListBox fit in a single pane. The value 2 causes the scrollbar to be invisible. If there are more items on the ListBox than can be viewed in a single pane, up and down arrows appear on the control. Figure 2 shows a snapshot of a form with ListBoxes using the three available settings.

Claudio Lassala is a Senior Developer at EPS Software Corp. and a part-time Universal Thread Consultant. He has presented several lectures at Microsoft events, as well as at several conferences and user groups in North America and Brazil. He is a Microsoft C# MVP, and MCSD for .NET, and also a columnist at MSDN Brazil. He is the author of several training videos that can be found at Universal Thread, and has had several articles published in various magazines, such as MSDN Brazil Magazine and FoxPro Advisor. A full-biography can be found at www.lassala.net/bio.
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date