August 5th, 2009

You are currently browsing the articles from KomKid.Net written on August 5th, 2009.

Axapta : Windows API

ตัวอย่างการเรียกใช้ Notepad

1
WinApi::shellExecute(strFmt('%1\\%2', WinApi::getSystemDirectory(),'\\notepad.exe'),fileName);

Written by Komkid on August 5th, 2009 with no comments.
Read more articles on Axapta and Programming.

Axapta : Form Control Type & Class Name

ActiveX => FormActiveXControl

Animate => FormAnimateControl

Button => FormButtonControl

ButtonGroup => FormButtonGroupControl

CheckBox => FormCheckBoxControl

ComboBox => FormComboBoxControl

CommandButton => FormCommandButtonControl

DateEdit => FormDateControl

Grid => FormGridControl

Group => FormGroupControl

GuidEdit => FormGuidControl

HTML => FormHTMLControl

Int64Edit => FormInt64Control

IntEdit => FormIntControl

ListBox => FormListBoxControl

ListView => FormListControl

MenuItemButton => FormFunctionButtonControl

MenuButton => FormMenuButtonControl

Progress => FormProgressControl

RadioButton => FormRadioControl

RealEdit => FormRealControl

StaticText => FormStaticTextControl

StringEdit => FormStringControl

Tab => FormTabControl

TabPage => FormTabPageControl

Table => FormTableControl

TimeEdit => FormTimeControl

Tree => FormTreeControl

Window = > FormWindowControl

http://msdn.microsoft.com/en-us/library/aa606405(AX.10).aspx

Written by Komkid on August 5th, 2009 with no comments.
Read more articles on Axapta.

Axapta : Acces any Control or Grid for update

ตัวอย่างการเรียกใช้ Dialog เพื่อ update ค่าใน Control ใด ๆ ใน Grid
ตัวอย่าง เพิ่ม button ใน form InventJournalTrans เพื่อลงทะเบียน Batch แล้ว Paste ลงไปในช่อง Batch

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
void clicked()
{
    Dialog dl;
    DialogField dlfItemNo,dlfBatchId;
    FormStringControl strItemNo,strBatchId;
    InventBatch inventBatch;
    InventTable inventTable;
    ;
    super();
    // Handle the control StringEdit "InventJournalTrans_ItemId" (field Item number).
    strItemNo = element.design().control(control::InventJournalTrans_ItemId);
    strBatchId = element.design().control(control::InventDimReceipt_InventBatchId);
    // Check Inventory Dimension Group of the item.Only "WLB" use Batch.
    SELECT * FROM inventTable WHERE inventTable.ItemId == strItemNo.valueStr();
    if(inventTable.DimGroupId=="WLB"){
        // Create dialog that Item number is prompted.Wait for BatchId.
        dl=new Dialog("Create Batch");
        dlfItemNo=dl.addFieldValue(0,strItemNo.valueStr(),"Item No.");
        dlfBatchId=dl.addField(0,"Batch Id");
        dlfItemNo.enabled(false);
        if(dl.run() && dlfBatchId.value()!=""){
            // insert into InventBatch table.
            SELECT * FROM inventBatch;
            inventBatch.inventBatchId=dlfBatchId.value();
            inventBatch.itemId=dlfItemNo.value();
            inventBatch.insert();
            strBatchId.setFocus();
            strBatchId.pasteText(dlfBatchId.value());
        }
    }
}

Written by Komkid on August 5th, 2009 with no comments.
Read more articles on Axapta and Programming.

Axapta : Confirm dialog

1
2
3
4
5
6
    DialogButton    result;
    ;
    result = Box::yesNo("คุณแน่ใจหรือไม่ ?",DialogButton::No);
    if(result == DialogButton::Yes) {
      // คำสั่งที่จะให้ทำเมื่อผู้ใช้ตอบยืนยัน
    }

หรือใช้คำสั่งแบบไม่ต้องประกาศตัวแปร

1
2
3
4
5
if(box::yesNo("Do you want something to happen?",
      dialogbutton::Yes) == dialogbutton::Yes)
   {        
           //do something
    }

Written by Komkid on August 5th, 2009 with no comments.
Read more articles on Axapta and Programming.

JavaScript : set, get and delete cookie

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function deleteCookie( name, path, domain ) {
if ( Get_Cookie( name ) ) document.cookie = name + "=" + ( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) + ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

Written by Komkid on August 5th, 2009 with no comments.
Read more articles on JavaScript and Programming.

« Older articles

Newer articles »