Speed-search/auto-complete in Uniface?

Author: zdenek.socha@fullsys.cz (sochaz)

Hello, we have a form with some hierarchical data presented in a tree widget. We need to allow user to search for something. So we have an editbox with OnEdit allowed. On every change we want to show corresponding results - in a pop-up form. With autofocus it works fine, but the delay of OnEdit is too short and can't be changed :(. Most of the users are unable to type so fast.. so we need to allow user typing and we need to update results with every change (on every OnEdit). Problem is, that the popup window don't have a focus. We use InitialFocus=False (during newinstance) and it works fine. Well. Not really. In this case the popup form is not closed correctly. If focus is changed, menu is activated etc... Uniface keeps this pop-up form visible. Have anyone tried the similar? Have anyone solved the problem? I have tried to deleteinstance in LeaveField, but it solves only Leaving the field. If I put deleteinstance in FormLosesFocues and user enter the pop-up form, Uniface crashes. Zdeněk Socha

1 Comment

  1. Some years ago I think there was a similar kind of requirement (that did not include a separate component) that was available in a downloadable example. Just tried to Google for it but unsuccessful. Anyway, if I remember it went something like this.... * I believe it was an old UniField as the search field, as this allowed for the positioning of the cursor. On <StartMod> perform a macro "^NEXT_FIELD". * In a NDI field (maybe empty image widget) painted immediately after the UniField, do this in the <FGF>...  - call proc to fetch/search using contents of UniField (in your case, activate the proc in the child instance).  - macro "^PREV_FIELD" * Then, on <FGF> of UniField, macro "^END" (not sure of exact macro name, but whatever the macro is to place the cursor after the last character in the field) That should fire all the right triggers for your prompting requirements. Not tested here, but it might be worthwhile playing around with this type of thought. Good luck.


    Author: rkrite (rkrite@gmail.com)