In This Topic
The Define Questions List
This section will expand on the details of each column (or field) in the Define Questions list. You will notice that certain fields in the list become greyed out as you change values, this is because those particular fields are not applicable at that time. An example is when you set the Control to something other than a list, the Combo Source field becomes disabled because it is no longer relevant. When you select a list from the Control field, the Combo Source field becomes active again.
To locate information about any options on the following image, click on the area of interest.
This is the name of the property from the All Answers tab to place the result from this question into. For example, if we wanted to control a property called "benchtop_thickness" using an edit box, we would create a question with "benchtop_thickness" in the Name field.
Some types of question can't have or don't need a value in the Name field, such as a static text label. In this case the field will either be disabled or you can just leave it blank.
The value of the Question field is the text prompt associated with a question. It lets the user know what the control is used for, and every type of control should have the Question field filled out. It should be in plain English, such as "What is the thickness of the benchtop?" or more concisely, "Benchtop thickness:".
For most control types, such as an edit box, lists, and checkboxes, the Question text is typed next to the control. With buttons and group boxes, the Question text appears on the control itself. The Question field of a question can be formula-controlled, just put an equals sign or colon in front of the formula so that it is not inter
This allows you to set which type of answer the question will accept, such as a text string, a length, a time, etc. The available types are listed on the
Data Types page. When you are using the question to control a property, you should set the question to be the same data type that the property is.
This field determines how the question will appear on the Friendly Page, and allows you to select which Windows control to use. Certain controls are better for some kinds of question, e.g. a checkbox is best for a question requiring a Yes/No answer.
- Category/Group Box:
These are outline frames which can be placed around a set of related questions. Adding a control of this type will start a group box, and any questions after it will be placed inside the box. You can mark the end of a group box by either starting a new one, or adding another group box control and clearing the Question field.
- Static:
This is a text label which cannot be edited by the user. They are handy for displaying hints on using the friendly page, or showing the results of some calculation based on other questions. If you set the Question field to be empty, you can also use them as blank spacing lines to pad out the questions on your friendly pages.
- Edit:
This creates a normal text box question where the user can type in an answer. To restrict the answers they can enter, make sure you set the Type field correctly.
- Checkbox:
These return a Yes/No answer, and are perfect for "flags" (on/off variables) such as "Show doors on cabinets?".
- Option:
Option (radio) buttons are like checkboxes except only one button in a group can be selected at once. They can either each control a separate variable or can control a single variable with a different value depending on which is selected.
- Drop Down:
A drop-down is usually referred to as a "combo box" because it is a cross between an edit box and a drop-down list. It allows a user to type in any value they like, or they can select from any preset values that have been provided in the list box.
- Drop List:
The drop list is also called a drop-down list, and it provides a list of values that the user must select from. Unlike the combo box, the user cannot type in a custom value - they must use one of the options that you specify. By default, a drop-down list shows the text "<Select>", which means that no value has been picked yet. If the user tries to leave a page with any lists like this they will get a warning saying that some lists remain unanswered.
- Button:
A button control is not used to answer a question but to perform some action, such as popping up a message box or writing to a file. It is essentially just used to run the formula in the Action field.
- Thumbnail:
Can be used to create a small image display area on a friendly page. This control is designed primarily for viewing textures, but can be used for other image files as well.
- Slider:
Creates a slider bar which can be either vertical or horizontal. To create a horizontal slider bar, make the width greater than the height and vice versa for a vertical slider. We also have lots of control over detailed setup. There are options for turning ticks on and off. We can also optionally set the step size for the keystrokes like up/down, pgup/pgdn. Home and End are also supported to go to the end of the slider, and of course mouse dragging of the slider itself is supported as well. In the screen shot, "Slider is now..." is just a static text control that happens to have a formula using the cabinet answer for the slider nearby. Of course, the value of the slider variable could just as easily be used for anything else you like.
Click to view Friendly Page Editor accessed from Define Groups page
We use the "Extra" field to control the setup of the slider. This is a pipe separated list specified as follows min|max|tick-interval|interval-keyupdown|interval-pageupdown.
- min: min integer for slider start
- max: max integer for slider finish
- tick-interval: distance between each tick in the slider. Set to 0 to hide ticks
- interval-keyupdown: amount moved when up/down arrow keys pressed
- interval-pageupdown: amount moved when page up/down keys pressed
For example, if you wanted a slider to go up by 5 units, starting from 0 to 100, with ticks defined every 10 units, you would set the extras field to 0|100|10|5|5. The resulting slider is shown:
You can see that the ticks are at every 10 units, but the user is able to go up or down in increments of 5.
We can also control the style of the slider. We support the following options:
1 |
TBS_AUTOTICKS |
The slider has a tick mark for each increment in its range of values |
4 |
TBS_TOP=TBS_LEFT |
Displays ticks above a horizontal slider or to the left of a vertical slider. |
0 |
TBS_BOTTOM=TBS_RIGHT |
Displays ticks below a horizontal slider or the right of a vertical slider. |
8 |
TBS_BOTH |
Displays tick marks on both sides of the control. This will be top and bottom for a horizontal control and left and right for a vertical slider. |
Open
SliderTest2.qid for an example of how slider controls work.
This is a whole number that determines the style of the control being displayed. To set a style, add the numbers below.
The Combo Source field is used with list controls to specify where the contents of the list are drawn from. It is only active when you set the Control field to either "drop down" or "drop list".
- List: The list options will be entered in the Extra field, separated by pipe characters "|". This is the default method, and is used when none of the others are appropriate. See the Extra field below for details.
- From File: Means that the text file specified in the Extra field will be opened, and each line in the file will be added to the list as an option.
- File Names: The names of files in a certain folder will be listed. The folder is specified using the Extra field, and must include a wildcard specification such as "c:\*.*". The files will be listed without their file extensions. A special wildcard *.images is recognised here also, and this looks for all known image files (*.bmp,*.jpg etc) and lists those files. A typical use of this is for listing available bitmap colours, where you would use a formula-controlled filename like = BITMAP_FOLDER & "\Cabinet\Color\*".
- Folder Names: Similar to "File Names", except the sub-folders inside the specified folder are listed. This option also has a similar typical use, for listing colour ranges which have been organised into folders.
Like Combo Source, this field is only active when the Control field is set to either of the two list types. It allows you to specify how the answer will be read from the list, either as the text visible in the list control, or the index of the selection.
The index of the selection is where it appears in the list box, starting with an index of 1. This means if the user selects the third item in the list, the number 3 will be returned. An index of zero indicates that no selection has been made yet, or that the user has typed in their own value in the case of a combo box.
The Enable field determines whether a control is visible on a Friendly Page or not and whether it is active or not. It is used to disable or hide controls which are not currently relevant, and is usually formula-controlled. Enable modes 0 to 4 are supported. For ease of use, Yes or No is also supported (Yes is same as 3 and No is same as 0). Also, if nothing is entered in the Enable field, it defaults to Yes and shows the question.
An exception to this is when there is a formula behind the variable being displayed in a control. In this case, the control will be disabled even if you set enable to Yes, because changing the value would make it inconsistent with its own formula. Enable mode 4 overrides this behaviour, and if the user changes the value, any formula behind the controlling variable is deleted. Typically, you would use SetFormula actions behind a button elsewhere on the page to allow the user to restore these formulas when using mode 4.
The Enable field should contain a formula which evaluates to a whole number or Yes/No, or just the literal mode. Possible modes for the Enable field are:
Mode |
Description |
0 or "No" |
The control is hidden and collapsed. Other controls below move up the page to fill up the space |
1 |
The control is hidden but does not collapse. A blank space is left where the control normally appears, which means when the control is re-enabled, the other controls on the form don't have to re-position themselves. |
2 |
The control is disabled (greyed out) but still visible. This method is usually preferable as it lets the user see that the controls are available, but are activated by another option |
3 or "Yes" or empty |
The control is visible and enabled. This is the default state, and lets you actually use the control. |
4 |
A control which is active will be disabled if there is a formula behind its controlling variable, This enables the control regardless, so you can still enter new values. If a new value is entered, the controlling formula will be deleted. |
This field contains any additional information required for drop-down lists. Depending on the Combo Source selected, the Extra field will contain either a list of options, or a folder path.
A list of options is provided as a "pipe-separated string". This means all the possible values in the list are joined into one string with pipe characters "|" in between them. So to have a list box containing several colours for example, we would type in "Red|Green|Blue|Black".
The terms QWidth and AWidth mean "question width" and "answer width" respectively. Each Friendly Page is divided up into six invisible columns, and our controls can fill up as many columns as needed up to the full six. The "question" part is the text prompt for edit and list boxes, and the "answer" is the actual edit or list box. It depends on which type of control a question is, but which part is "question" and which part is "answer" should be made clear depending on which of these fields are enabled.
The default QWidth and AWidth are both 3, which means they will both take up half the width of the page. If both are narrow enough (i.e. set to 1 or 2), following questions may be placed on the same line if they are also narrow enough. This means you can fit more than one control per row on a Friendly Page.
Height
Normally, each control in a friendly page is just the height needed for one row. You can however increase the height of a control – just specify the number of rows high, e.g. say 3 if you want the control to be 3 rows high.
For the purposes of set out, you will need to leave empty controls to make the space available sometimes, as a control greater than one row high could overlap controls in the rows above. The friendly page editor does this more automatically for you, when necessary.
This field is used for running formulas when a control is changed. The obvious example is executing a function when a button control is clicked, but any editable control can have an Action, not just buttons. The function in the Action field is run (or "fired") when the value of a control is changed, i.e. when a checkbox is clicked, when a value is selected from a drop-down list, or when a text box is edited.
Any function can be included in an Action formula, but the most common types are those referred to as
Action Only. An Action field is the only place you can use these types of formula, because they perform actions with real effects, such as displaying a message box or editing a file on disk. See also: Tutorial on
Showfriendlypages Popup
Example
The following is an example only of how the above fields are used.