Change Prompts
- Last UpdatedNov 07, 2024
- 2 minute read
In several instances it may be necessary to change the prompt of an event, which is already within the event system.
There are two methods available to change the currently active event prompts. These can be used to change either only the primary prompt or the primary and secondary prompts of the event (see below for definition of primary and secondary prompts).
The modifying of prompts should only be necessary where an event packet is recursive, as in, it reinstates itself into the system, and subsequent picks require a different prompt from the first pick.
A typical example of this type of use is the creation of a SCTN (section), the first pick is the "start" of the section, the second is the "end". After the first pick, the event pick data is cached, on completion of the second pick, the section if created.
The following is an example of where a packet's action (a method on a controlling form) requires the subsequent prompts to be indexed until 4 picks have been made:
-- Check if there are less than 4 elements in the cache
if(!this.cache.size() lt 4) then
-- Increment the prompt of the next pick
!!edgCntrl.setPrompt('Primary prompt', !this.cache.size().string())
-- If there are 4 pick, process the data
else
-- Process the pick data
!this.processData()
-- Initialise Data
!this.cache.clear()
-- Redefine first prompt
!!edgCntrl.setPrompt('Primary prompt', 'pick first point')
endif
Note:
Several of the predefined event packets, maintain the prompts in a more direct manner,
these mechanisms must not be copied by the developer, as they are maintained by the standard product and could
potentially change without notification.
A third method of the event system, allows a stacked events primary prompt to be changed. This will mean that when the event is reinstated as the active event, the prompt will be different, than when it was added to the stack.
This is basically the same as the setting of the primary prompt of the currently active event, but changes the event by description. This is regardless of whether the event is active or stacked.