- This lesson will teach you the following concepts
- How to view the element to which the current event belongs?
- How to print the source code?
- How to perform a "find and/or replace"?
- What is the meaning of "+" and "-" signs in the code editor?
- Is it possible to identify the person who wrote a code line?
- Is it possible to find out the number of a code line?
- Is there a method to easily display the syntax or the help about a function?
- What are the useful shortcuts in the code editor?
- How to communicate with the user?
Lesson 2.5. Questions/Answers
This lesson will teach you the following concepts
How to view the element to which the current event belongs?
To view the element corresponding to the current event, go to "Code" pane, "Navigation" group, click "Go to element" (Ctrl + Alt + F2). The page containing the requested element is displayed.
How to print the source code?
To print the current source code, click the
icon in the "Home" pane or press Ctrl + P.
How to perform a "find and/or replace"?
The functions for performing searches or replacements (in the code, in the interface, ...) can be accessed from the "Home" pane, in the "Find" group or in the "Find - Replace" pane (Ctrl + F) :
Then, you have the ability to define the different characteristics of the search to perform.
What is the meaning of "+" and "-" signs in the code editor?
The code editor allows you to expand or collapse the WLanguage code. This feature is very useful if your processes use a lot of structured statements (loops, conditions, browses, ...).
To collapse a code, on the "Display" pane, expand "Collapse" and select "Collapse all" (or press Ctrl + Shift + * (on the numeric keypad)).
Only the comments remain visible. The associated code is displayed in a tooltip when the comment line is hovered by the mouse cursor:
Press Ctrl + * (on the numeric keypad) to expand the entire code. A click performed on the "-" or "+" symbol allows you to collapse or expand the corresponding code section.
Is it possible to identify the person who wrote a code line?
Press F6 to display information (name and creation/modification date) about each code line.
Is it possible to find out the number of a code line?
In the code editor, to enable (or not) the numbering of code lines, on the "Display" pane, in the "Help for edit" group, click "Display the line numbers" (shortcut: Ctrl + Shift + G).
Is there a method to easily display the syntax or the help about a function?
When typing a function in the code editor:
- the name of each parameter is displayed in a tooltip for the code line currently in edit. For the parameter currently in edit, hovering the parameter name with the mouse is used to display the parameter details in a tooltip.
If several syntaxes are available, press Ctrl + Alt + Right or left arrow to go from a syntax to another one.
- the function syntax is displayed in the status bar of editor.
In the help, the parameters enclosed between [ and ] are optional parameters.
For the functions that require names of data files, controls, windows or reports, the assisted input is used to display the list of project elements corresponding to the parameter of the function currently typed.
Examples of assisted input for HReadFirst
: the <Wizard> option is used to start a code wizard. This wizard asks you questions regarding the function use and it automatically generates the corresponding code.
A help page is associated with each WLanguage function and property. This help page can be directly accessed from the editor by pressing F1 on the name of requested function or property.
What are the useful shortcuts in the code editor?
- To display the events of a control, method, class, procedure or report block, press F2 while on the name of the desired element.
- Ctrl + F2 is used to go back to the initial process or event.
To move from one process/event to another, press F2 repeatedly. To go back to the initial process or event, press Ctrl + F2 the same number of times.
- Ctrl + L deletes the current line.
- Ctrl + D duplicates the current line (or the selected lines) on the line below.
- Tab (tab key) and Shift + Tab are used to manage the indent for the selected lines.
- Ctrl + / converts the selected lines into comments, Ctrl + Shift + / removes the comments (Caution: / key on the numeric keypad).
- Ctrl + R is used to automatically re-indent the displayed code.
How to communicate with the user?
All you have to do is use an advanced dialog box. These dialog boxes are used to manage:
- the directive questioning (Dialog): the user answers a question via the buttons containing the text of the action to perform.
- the immediate input (Input), by allowing the user to type the requested value in the dialog box.
- To check the different modes for communicating with the user:
- Open the "WD My first windows" project if necessary: on the "Home" pane, in the WINDEV home page (Ctrl + <), click "Tutorial" and select "My first windows (Answer)".
- Open the "WIN_Dialog" window. This window presents the different dialog modes.
- Run the window test ( button).
- Click the different buttons to check the different dialog modes.
- Stop the test of this window and go back to the code editor to study the code of each button.
Click [Add] to post a comment