DOCUMENT #779 =========================================================================== MENULESS FORMS =========================================================================== PRODUCT: R:BASE VERSION: 4.5+ or Higher =========================================================================== CATALOG: Forms, Reports & Labels AREA : Forms =========================================================================== Menuless forms have been available in R:BASE since 3.1B but the Esc and Enter keys were the only ones that could be used to control data entry -- Esc left the form, and Enter added a row. This limited the usablity of menuless forms and they could not be used in forms with regions. New form features and EEP commands in 4.5 Plus! make menuless forms much more usable. Adding data with a menuless form Use the F10 key in 4.5 Plus! when adding data to save a row and present a new row for entering data. The F10 key acts just like the Add row option on the form menu. It works well with all types of forms, including multi-table forms with regions. Without this option, if your last table is a region you can't use menuless forms to add data. You can also use the F9 key to discard data. When you Esc to leave the form, if you have not saved your data you will get the Do you want to save your changes? dialog box. Editing data with a menuless form Note that the F9 and F10 keys will not work when editing data with a menuless form. They are only active in edit mode if you have the menu selections Add row and Delete row selected. Instead of using the function keys, place a "toolbar" on your form that simulates these actions as well as moving between rows. This tip comes from Wayne Erickson, Microrim Chairman and Founder. He has used new EEP commands to create a "toolbar" for use with the mouse and a menuless form. The "toolbar" is a series of variables. The variable definition is simply the text you want to appear in the "button", for example, vnextrow = 'Next'. Customize the field settings for colors. You can change the color of the line draw character now on the Form settings screen, so you can draw a different colored line, red, for example, around the "buttons" on the "toolbar". Make sure all the variables allow data entry. Each variable has an EEP defined "On entry to the field". The EEP executes when the mouse clicks on the field. This type of form is designed for use with a mouse, not for keyboard entry -- you need to be able to randomly select the "buttons" on the "toolbar", you can't access them in order since you have entry EEPs defined and they will all execute as you move through them. It works best on a single page, single table form. The form has these "buttons" on the "toolbar": Next -- move to the next row in the table, the same as pressing F8 Prev -- move to the previous row in the table, the same as pressing F7 Search -- search for a specific data row, the users is prompted to enter a search value NewRow -- add a new, empty row to the table Delete -- delete the current row from the table, the unique row identifier is passed to the EEP through a form expression Quit -- leave the form These EEPs are placed on the respective "toolbar buttons". They all use th e SKIP TO command to return to the first data field in the form after executing the EEP commands. *(NEXTROW.EEP) NEXTROW SKIP TO firstname SCREEN RESTORE OFF *(PREVROW.EEP PREVROW SKIP TO firstname SCREEN RESTORE OFF *(SEARCH.EEP) SET ERROR VAR imstat DIALOG 'Enter the last name you are looking for' + vsearch=16 vkey 1 AT 15 IF vkey = '[Esc]' THEN RETURN ENDIF -- Search for matching record WHILE #PI <> 0.0 THEN IF vlastname CONTAINS .vsearch THEN BREAK ENDIF NEXTROW IF imstat <> 0 THEN PAUSE 2 USING 'No matches found' AT 15 CENTER DEFAULT BREAK ENDIF ENDWH SKIP TO firstname SCREEN RESTORE OFF SET ERROR VAR OFF RETURN *(NEWROW.EEP) NEWROW SKIP TO firstname SCREEN RESTORE OFF *(DELETE.EEP) -- this EEP needs a form expression, vlastname = lastname, -- to store the row identifier SET MESSAGE OFF DIALOG 'Are you sure you want to delete this row?' doit fkey NO AT 13 IF doit = 'YES' THEN DELETE ROW FROM people WHERE lastname = .vlastname AND LIMIT = 1 SET MESSAGE ON NEXTROW ENDIF SKIP TO firstname SCREEN RESTORE OFF *(QUIT.EEP) PLAYBACK esc.ply The file esc.ply contains the single keystroke Esc. It is easy to make using the new RBEdit menu option, New playback file. Simply choose that menu option, enter the keystroke enclosed in square brackets, [esc], then save the file. That's it.