The easiest way to change a text in a Rich Text field (or other field types) according to the buttons clicked by the user (i.e. a form with 4 buttons) is to build 4 Rich Text fields and start playing with them inside the buttons using a simple FDO code.
- Put the 4 fields in the same place and turn the VISIBLE property “ON” for the first field.
- Turn the VISIBLE property “OFF” for the rest of the fields.
- Set IDs for the 4 fields, like 20, 21, 22 and 23.
- Save the form.
- Start coding the first button. Select the ACTION property for the button. Choose “Select” event. Choose “FDO” action. Click on the “EDIT” button and put the code below into the edit window:
uni_start_stream
man_set_context_relative <20>
mat_bool_hidden <no>
man_end_context
man_set_context_relative <21>
mat_bool_hidden <yes>
man_end_context
man_set_context_relative <22>
mat_bool_hidden <yes>
man_end_context
man_set_context_relative <23>
mat_bool_hidden <yes>
man_end_context
man_update_display
uni_end_stream
- Click on “COMPILE” button to check for errors.
- Note the code for this first button: we are changing the Hidden property for the first field to <no>. The process for the other 3 fields is the same, you have to change this property to according to the button being manipulated.
How Does It Work ?
uni_start_stream is the beginning of the process of an event.
man_set_context_relative is the command used to “select” an object into the code, so the subsequent commands are applied to him.
mat_bool_hidden controls the visibility state of an object.
man_end_context ends the object selection.
man_update_display needed to force the screen update of the form, showing all the changes made internally in it.
Uni_end_stream ends the stream execution.
That´s It!
Good FDOing !!!
Flavio Jarabeck.
