Hi,
you have to write the code like this,

dialogLocation.dialog().formRun().design().controlName('Fld2_1').setFocus();

To get the control name in dialog, 
Open the dialog -> Right click the control( dialogLocation) in dialog -> setup 
-> choose the "System name" value in User setup form.

Example:
I tried in AOT -> Class ->Tutorial_RunbaseBatch having the validate method, i 
wrote the code given below
public boolean validate()
{
    if (false)
        return checkFailed("");
    if(transDate == datenull())
    {
        
dlgTransDate.dialog().formRun().design().controlName('Fld1_1').setFocus();
        return false;
    }
    
    return true;
}
This code check, if the date field is null the cursor points(Focus) the Date 
field.

Thanks,
Vijay karthik.K

----- Original Message ----
From: bryanevil <[EMAIL PROTECTED]>
To: Axapta-Knowledge-Village@yahoogroups.com
Sent: Tuesday, July 10, 2007 9:56:26 AM
Subject: [Axapta-Knowledge-Village] how to set focus on a field in a dialog box?

Hi everyone,

How do I set focus on a field in a dialog ? my dialog got 2 fields -
dialogPallet and dialogLocation. What i try to do is when I hit OK
button and if the dialogLocation textbox is empty, set focus on the
dialogLocation text box. my code look like:

if(!location) {

this.dialog( ).formRun( ).design( ).controlName( "dialogLocation" ).setFocus( );

}

I got error : FormRun object not initialised

Can anyone help me on this? it is an urgent question. Thanks




Send instant messages to your online friends http://uk.messenger.yahoo.com 

[Non-text portions of this message have been removed]

Reply via email to