Step 4. Using a Busy Cursor
FRM025 - Insert a Database Record
Your applications should provide good feedback to the user, for example when routine will take more than a few seconds to complete. This step illustrates how to implement a
. Of course, in reality you wouldn't need this for a routine which performs a single record add.1. Event handling routines have a Com_Cursor() parameter which may have values of:
DEFAULT, *DELAY_01, *DELAY_02, *DELAY_04, *IMMEDIATE or *NEVER
The DELAY values are seconds.
2. Change the SAVE.Click routine to have Com_Cursor(*IMMEDIATE).
3. Use a Begin_Loop/End_Loop to add a delay at the start of the SAVE.Click routine. For example, your routine could look like the following:
Evtroutine Handling(#SAVE.Click) Com_Cursor(*IMMEDIATE)
#std_num := 0
Begin_Loop Using(#std_num) To(5000000)
#std_num += 1
End_Loop
Insert Fields(#empdata) To_File(pslmst)
Message Msgtxt('Employee number ' + #EMPNO + ' has been added')
#empdata := *default
Endroutine
Note: You may need to use To(10,000,000) for the Begin_Loop if you have a fast PC, in order to produce an noticeable delay.
Alternatively, you could have added a loop structure using DOWHILE/ENDWHILE or DOUNTIL/ENDUNTIL.
4. Recompile your form and test it, for example by trying to add a blank record. You should see the busy cursor displayed for a few seconds every time:
Other "delay" feedback techniques available include a
component and showing "stop" and "go" images.