To continue with this content, please log in with your Data Access ID or create a new account.
Cancel Data Access ID
You may not be authorized to see this content. Please contact Data Access Europe for more information.
Cancel Data Access Europe
You are not authorized to see this content.
Cancel Data Access Europe
Next lesson:
WebCommandBar
Cancel

Getting to know the Web Controls

Lesson 13.1 - WebCombo using FlexTron

In this lesson we will demonstrate how to use predefined Web Controls in a Windows applications, using FlexTron. We will focus on the WebCombo control. In the Getting to know the Web Controls playlist on the DataFlex Learning Center there’s a lesson available on how to use this web control. In this current lesson we will integrate the same control, but then in a Windows application using FlexTron.

The WebCombo is used to display a dropdown combo list. A combo control appears in two parts: the top part that displays the current value (e.g., the selected item) the second part is a list of items that can be selected by the user. Using FlexTron it is easy to integrate the control in your Windows application. It offers you to make use of modern technologies and the modern styling that is used in Web Applications.

A combo is ideal for data entry that requires the use to select from a pre-defined set of valid values. E.g., a view asking for the ‘state’ field of an address. And since we will be using it in FlexTron we are able to manipulate Windows controls with our web controls and vice versa.
You can use the WebCombo with or without data binding. When used with a data binding the combo provides automatic support to display and modify data from database column. Validation rules from the data dictionary are used to build the combo list. When used without a data binding you will use the class interface to populate the combo list. You do that by implementing the OnFill event to populate the combo list. For each item you wish to add the combo list you send AddComboItem with the value of the item and the description of the item a parameter to the procedure.

If you want to support the ability to select a null value from the combo list. You can set pbAddEmptyItem to True. You can also set psEmptyItemDescription to have a value to show that this is either an empty item or a placeholder on what the users must select.
To handle specific actions based on when the user changes the value of the combo list. You would require setting pbServerOnChange to True and implement the OnChange event where you can call functions that are required when the user changes the value of the combo list.

All right now you know more about the WebCombo, I will show a demo on how to easily implement it using FlexTron in windows application and how it looks.


DEMONSTRATION

  • I've copied the FlexTron example to another workspace and mixed up the Mixed Data Entry data entry view for this demo.
  • I've already added the DBLocalWebControlHost to this view. 
  • For this demo, I'm going to demonstrate how to add a WebCombo with a data binding. 
  • Let's first off start by changing the class palette view from Windows to web and extract the web component in the DBLocalWebControlHost.
  • And let's add a data binding for the customer state. Let's set the server to the customer data dictionary and add an entry item to the customer state.
  • If we run and compile this and open the Mixed Data Entry view you can see there is a WebCombo for the customer state.
  • And if we select one of the states, and then find it, you can see that it finds the customer that belongs to the state.
  • Let's go to the next demo where I'll show you a WebCombo without a data binding. 
  • I've already added another view for this with also the dbLocalWebControlHost. Let's drag a WebCombo in it.
  • Let's make this WebCombo the days of the week. 
  • Let's start by adding the OnFill event and use send AddComboItem with a day of the week for each day.
  • And now also set pbServerOnChange to true and add the OnChange event so that we can update the Windows Form based on the new value that we selected.
  • If we run and compile this and if we open in demo view, you can see the days of the weeks WebCombo.
  • If we change the value it also changes the Windows Form.

This demonstrates how you can easily use web controls in your Windows application using FlexTron!