Consultor Eletrônico



Kbase 13815: Example: no AUTO-ZAP for FILL-IN fields in Version 7
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/10/1998
Example: no AUTO-ZAP for FILL-IN fields in Version 7


The code example below shows how AUTO-ZAP can be disabled for fill-in
fields. AUTO-ZAP is a feature whereby when you enter a field, the
text already in the field is highlighted. This means that any
new characters typed in will delete the current text and replace it.
This contrasts with "insert" mode, which is what you get when you
click the cursor into place using the mouse then type characters.
The resulting text is inserted into the existing text without deleting
anything.

This code shows how to make sure "insert" mode is always used.
Here, when entering a field the cursor is placed to the far left of
existing text with nothing highlighted.

/* no-zap.p */

def var a as char init "abc".
def var b as char.
def var c as char.

form a b c with frame x.
display a b c with frame x.


on TAB of frame x anywhere do:

def var nextwid as widget-handle.
nextwid = self:next-tab-item.
if not valid-handle(nextwid) then do:
def var fgroup as widget-handle.
fgroup = self:parent.
nextwid = fgroup:first-tab-item.
end.

apply "entry" to nextwid.

/* auto-zap applies ONLY to widget currently with focus */
nextwid:auto-zap = no.
return no-apply.
end.

/* the code below is needed for the first time in */
on entry of frame x do:
def var hwid as widget-handle.
def var fgroup as widget-handle.
fgroup = self:first-child.
hwid = fgroup:first-tab-item.
hwid:auto-zap = no.
end.

update a b c with frame x.
enable all with frame x.
wait-for go of frame x.

Progress Software Technical Support Note # 13815