Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Edit Tables: Defaulting to Edit Mode (Functions/Subroutines/Programs) ====== ====== ====== ==== Created at 10 OCT 1996 04:54PM ==== **Introduction** The edit table defaults to navigatation mode. When a user starts typing, the current cell automatically switches to edit mode. This document describes how to make the edit mode be the default mode for an edit table. **The EditCell Function** The following function puts an edit table into edit mode (or takes it out of it) by using edit-table messages: function EditCell(CtrlEntID, EditMode) declare function Get_Property, SendMessage, GetAsyncKeyState declare subroutine Yield $insert Logical equ WM_USER$ to 1024 equ DTM_EDITCURCELL$ to WM_USER$ + 95 equ TAB$ to 9 equ DT_BEGINEDIT$ to 1 ;* begin edit mode equ DT_ENDEDIT$ to 2 ;* end the edit equ DT_ABORTEDIT$ to 3 ;* Esc will undo changes * get the window handle for the edit table hTable = Get_Property(CtrlEntID, 'HANDLE') if hTable else return FALSE$ end * the DTM_EDITCURCELL$ message is used to toggle the * edit table's edit mode Message = DTM_EDITCURCELL$ * default to edit mode if assigned(EditMode) else EditMode = "" if len(EditMode) else EditMode = DT_BEGINEDIT$ * if the user is tabbing, wait until they release the tab key loop while bitand(GetAsyncKeyState(TAB$), 32768) Yield() repeat Yield() if EditMode = DT_BEGINEDIT$ then * first exit then re-enter edit mode Result = SendMessage(hTable, Message, DT_ENDEDIT$ , 0) Result = SendMessage(hTable, Message, DT_BEGINEDIT$, 0) end else Result = SendMessage(hTable, Message, EditMode, 0) end return Result **Plugging it in** The easiest way to implement automatic edit mode is to set up the following QuickEvent on edit table's GotFocus and PosChanged events: {{kb0038_1.html; charset=utf-8}} Instead of using a QuickEvent, you can put the following event code in the edit table's GotFocus and PosChanged event handlers: Function PosChanged(CtrlEntID, CtrlClassID, NextColumn, NextRow) declare subroutine EditCell, Forward_Event * processing here is executed before the rest of the event chain * ... * let the rest of the event chain execute (and remember to pass any * parameters that follow CtrlEntID/CtrlClassID to Forward_Event) Forward_Event(NextColumn, NextRow) * processing here is executed after the rest of the event chain * ... * now put the cell into edit mode EditCell(CtrlEntID) return 0 **Source in Text Format** [[http://www.revelation.com/o4wtrs/KB_Articles/KB0038_files/EditMode.txt|**{{kb0038_2.html; charset=utf-8}}**]][[http://www.revelation.com/o4wtrs/KB_Articles/KB0038_files/PosChanged.txt|**{{kb0038_3.html; charset=utf-8}}**]]**** kb/kb_articles/kb0038.txt Last modified: 2024/01/30 13:36by 127.0.0.1