Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Custom Lookup and Lookup Shortcut Key

7 views
Skip to first unread message

Adam

unread,
Dec 15, 2009, 8:20:01 PM12/15/09
to
Hello,

In AX 2009, if I create a custom lookup for a textbox field, it works fine
if the user clicks the lookup button, but if you use the lookup shortcut key
(*), the form moves to the back behind the main ax window. Does anyone know
why this is and if there's a way to fix this?

Thanks,
Adam

P.S., here's an example of the code I'm using...

// text box lookup method
public void lookup()
{
super();
MyTable::lookupField(this, "ABC");
}

// lookup method on MyTable which displays values based on another value
public static void lookupField(FormStringControl _ctrl, str _value)
{
SysTableLookup lookup = SysTableLookup::newParameters(tablenum(MyTable),
_ctrl);
Query query = new Query();
QueryBuildDataSource qbds = query.addDataSource(tablenum(MyTable));
QueryBuildRange qbr = qbds.addRange(fieldnum(MyTable, MyField));
;
if(!_value)
throw error("Please enter a value in that other field");

qbr.value(_value);
lookup.addLookupField(fieldnum(MyTable, MyField));
lookup.addLookupField(fieldnum(MyTable, MyOtherField));
lookup.parmQuery(query);
lookup.performFormLookup();
}

Luegisdorf

unread,
Dec 21, 2009, 9:15:01 AM12/21/09
to
Hi Adam

Just seen one potential bug in your code. Don't know if this solves your
problem, but you can try:

You don't have to call super() in the lookup method; your static call
lookupField(..) should replace the super()-funcationality.


// text box lookup method
public void lookup()
{

// super();
MyTable::lookupField(this, "ABC");
}

May be that's it.

Regards
Patrick

Adam

unread,
Dec 21, 2009, 3:14:01 PM12/21/09
to
Patrick,

Thanks a lot for looking at my code! You were right on target.

Thanks again,
Adam

0 new messages