CONTROLS
Update an edit field linked to a scroll button
I have some static EF with scroll buttons attached. I'm using CALL TEINSERT to stick some names in the EFs. Problem is that the scroll buttons aren't working. Tried using CALL INVALRECT, didn't help. The only way I can get the scroll buttons to work is to resize the windows, which wouldn't be so bad except one of the windows is not resizeable (is that a word? if not call Webster gett'em to stick it their dictionary). Help... again
To insert a name in an EF I was using:
LOCAL FN InsertText (fieldID%, @strPtr&, startPos%, endPos%)
AUTOCLIP = 0
teH& = TEHANDLE(fieldID%) 'get field handle
LONG IF teH& 'is handle valid, then continue
strLen% = PEEK(strPtr&) 'get string length for insertion
CALL TESETSELECT (startPos%, endPos%, teH&) 'set selection in field
CALL TEINSERT (strPtr& + 1, strLen%, teH&) 'insert text into field
CALL INVALRECT (teH&..viewRect%) 'force fb to update field
END IF
END FN
The problem was the scroll button never became active in the static EF. Thought I had used this FN in something else I had done. But had used:
SETSELECT startPost%,startPost%
CALL TEINSERT(@placeThis$ + 1,LEN(placeThis$),WINDOW(_efHandle))
For some reason the scroll button worked doing things this way.
The other thing I was doing in a static scrolling EF was, list names when the window was opened using:
EDIT FIELD _EF1WClass9
EDIT TEXT _geneva,9,0
LONG IF gNumOfEntries% > 0
FOR x = 0 TO gNumOfEntries% - 1
eNum$ = FN CleanSTR$(bwlrInfo.entryNum%(x))
lNm$ = bwlrInfo.lastName$(x)
fNm$ = bwlrInfo.firstName$(x)
avg$ = STR$(bwlrInfo.average%(x))
IF bwlrInfo.entryNum%(x) <>bwlrInfo.origEntryNum%(x) THEN lNm$ = lNm$ +" (r)"
d$ = "(" + eNum$ + ") " + lNm$ + ", " + fNm$ + " @ " + avg$ + CHR$(13)
CALL TEINSERT(@d$ + 1,LEN(d$),WINDOW(_efHandle))
NEXT
END IF
The scroll button would never go active, when there were more names then would fit into the visible region, until I resized the window.
Added the below and it got things working.
AUTOCLIP = _False
EDIT FIELD -_EF1WClass9,,,_noFramed
(EDIT FIELD _EF1WClass9)'removed this line
[code from above to insert text goes here]
teH& = TEHANDLE(WINDOW(_EF1WClass9))
CALL INVALRECT (teH&..viewRect%)
AUTOCLIP = _True
EDIT FIELD -_EF1WClass9,,,_statNoFramed
EDIT FIELD 0
That got things working. If someone sees a problem the above might cause please let me know.
Insert the last character after you do the TEINSERT.
CALL TEINSERT(@txt$+1,len(txt$)-1,myTEHndl&)
TEKEY$ = right$(txt,1)
|