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:
DataFlex Web Applications and conclusion
Cancel

Learn the language

Lesson 8: Structure of a DataFlex Program

Let’s look at the structure of a windows program

  • If you look at the object structure of the view in the example you see that the UI is built by nesting objects. In the middle you see the tree structure. The selected object is oCustomer_State, on the left side you see it in code form and on the right you see the final output of oCustomer_State. 
  • DataFlex windows applications are event driven, that means that your program gets rendered on screen and will go into a message loop. Nothing will happen until the user performs an action.
  • In DataFlex you can implement procedures directly on your object to handle these events. For example if you have a button, that will be an OnClick procedure, it will be fired by the program as soon as the button is clicked.

Demonstration

  1. Projects > New > Windows Project > OK
  2. Name your project, in this case: LearnTheLanguage

NOTE: The DataFlex Studio generates a new project and in this project it already generates several objects i.e. menu bars and tool bars.

3. If you click on an item in the designer, you see that is also selects the item in the code explorer. This shows us the object structure of your program.

4. Double click on one of these objects. You see that all of these objects are based on classes and these classes are based on UI classes

5. Create New > Tabbed View > OK

6. Name the object: TabbedDemo

7. OK > YES

8. Let’s take a look at the object structure. Select a label in the designer window and have a look at the Code Explorer. Here you can see that this view is basically a tree structure of nested objects.

9. Double click on the object to switch back to the source view.

10. In the source view you see that there are several nested objects. oTextBox is based on the text box class and it configures the UI object by setting properties like label, location and size.

11. Go back to the designer panel.

12. Make some space for a new object that we are going to create.

13. View > Class Palette

14. Click and drag “Button” from the class palette into the designer panel.

15. Change the label of “oButton1” into ‘say Hello’, in the properties panel.

16. Click on the ‘events’ tab in the properties panel.

17. Double click on “OnClick”.

18. It has generated the procedure OnClick

19. Add the following line to your code

20. RUN (F5)

NOTE: The outermost panel comes up, it has added our TabbedDemo under view

21. Click the “Say Hello” button and you should see an infobox pop-up that says: Hello World

This showed how windows user interfaces are build up and how you can handle events of the user interface. That’s basically how you build your application in DataFlex.