We are going to use a couple of entry points, one of which is located in the GACTION file, and the other in GOBJACT. So you must have the following setup in your entry points function (GESAPE):
ZSELRAP is the name of the file where we are going to write the custom code for the entry points. Of course, you can give it a different name. In this file, you have to place the following code:
$ACTION
Case ACTION
When "SELRAP" : Gosub SELRAP
When "SELRAPOBJ" : Gosub SELRAPOBJ
Endcase
Return
$SELRAP
For I=1 To NBCOL
If SAIRAP(I)<>"" & !instr(1, SAIRAP(I), "*")
SAIRAP(I)="*" + func AFNC.TRANSF(SAIRAP(I), " ", "*") + "*"
Endif
Next
Return
$SELRAPOBJ
For I=1 To NBSEL
If SAIRAP(I)<>"" & !instr(1, SAIRAP(I), "*")
SAIRAP(I)="*" + func AFNC.TRANSF(SAIRAP(I), " ", "*") + "*"
Endif
Next
Return
Case ACTION
When "SELRAP" : Gosub SELRAP
When "SELRAPOBJ" : Gosub SELRAPOBJ
Endcase
Return
$SELRAP
For I=1 To NBCOL
If SAIRAP(I)<>"" & !instr(1, SAIRAP(I), "*")
SAIRAP(I)="*" + func AFNC.TRANSF(SAIRAP(I), " ", "*") + "*"
Endif
Next
Return
$SELRAPOBJ
For I=1 To NBSEL
If SAIRAP(I)<>"" & !instr(1, SAIRAP(I), "*")
SAIRAP(I)="*" + func AFNC.TRANSF(SAIRAP(I), " ", "*") + "*"
Endif
Next
Return
Two entry points are used: SELRAP and SELRAPOBJ. One of them takes care of the quick search string in the left box, and the other - in the selection box. But the functionality is exactly the same: we loop through the quick search strings for all columns (available in the indexed variable SAIRAP) and if the quick search string is not empty and does not already contain stars (meaning that we explicitly want to use the star functionality), stars are added to the beginning and the end of the search string, as well as in the middle, replacing all spaces.
To make the newly created entry points functional, you might need to logout of X3 and login again.
So now, if we enter the search string MyCompany, it is going to be transformed to *MyCompany* automatically. And My Company will become *My*Company*. This way you can stop entering manually all those stars every time you want to quick search in a left list or a selection box.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.