Show drop-down list when entering a non-existent item

  • A user can get a dropdown list, just by typing a few letters and pressing enter. (Instead of entering a * to trigger the drop down list or instead of using the mouse)


  • The following static method can be called from the overridden task method of any form. The current implementation only supports ItemId and RouteOpr field. (It would be great if this code were generalized by someone.)
  • NOTE: relies on field name

//bw start
//Changed on 16 Jul 2007 by TW
/* Description:
display dropdown list if enter clicked while an itemid is not valid
static public int task(Args args, int _taskId)
    #MACROLIB.Task //import task macro
    FormControl fc;
    FormStringControl fsc;

        case #taskEnter: //enter key pressed
            fc = args.caller().selectedControl();
            if (SysFormRun::controlType(classidget(fc)) == FormControlType::String)
                fsc = fc;

                if ( like "*" + fieldid2name(tablenum(InventTable),fieldnum(InventTable,ItemId)) + "*")
                { //ItemId fields
                    if (!InventTable::exist(fsc.text()))
                        return 1;
                else if ( like "*" + fieldid2name(tablenum(InventTable),fieldnum(Route,OprId)) + "*")
                { //RouteOpr Fields
                    if (!RouteOprTable::exist(fsc.text()))
                        return 1;
    return 0;
//bw end


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s