tailieunhanh - 1001 Things You Wanted To Know About Visual FoxPro phần 3

Tham khảo tài liệu '1001 things you wanted to know about visual foxpro phần 3', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 92 1001 Things You Always Wanted to Know About Visual FoxPro .Value EVAL .cAlias . .cField ENDIF ELSE Otherwise save the current work area before switching to the specified table lnSelect SELECT SELECT .cAlias And locate the specified record LOCATE FOR UPPER AlLtRIM eval .cField UPPER lcSoFar IF FOUND .Value EVAL .cAlias . .cField ENDIF Restore the original work area SELECT lnSelect ENDIF ENDIF At this point we have either found the desired record in cAlias or we are at the end of the file. All that remains to be done is to reset the highlighted portion of the text box correctly and refresh the controls in the parent container if this was specified by setting .lRefreshParent .T. If we need to refresh the parent container do it here IF .lRefreshParent .RefreshParent ENDIF Highlight the portion of the value after the insertion point .SelStart lnSelStart lnSelLength LEN .Value - lnSelStart IF lnSelLength 0 .SelLength lnSelLength ENDIF If we have refreshed the controls in the parent container there are timing issues to overcome Even though .SelStart and .SelLength have the correct values the search box does not appear highlighted correctly without this delay INKEY .1 H ENDWITH Notice the INKEY command here and take some time to read the comment above if you haven t already. This problem is not specific to our incremental search text box and timing issues like this are not uncommon in Visual FoxPro. We have also run into it when displaying multi-select list boxes in which the previous selections are highlighted. In that case using INKEY in the form s refresh allows the list box to be highlighted correctly. It is interesting to note that the INKEY command is not required in the code above when IRefreshParent .F. This lends support to the assumption that this is nothing more than a timing issue. The short pause allows Visual FoxPro to catch up. Numeric text box Example txtNum and txtNumeric Visual FoxPro has inherited some serious shortcomings with respect to .