>> Project 진행시 많이 나타나는 화면 유형처리
> KeyBoard 제어/이동 처리(tip_key_move.xml)
1) Key Control/Visible
// 제품 EditBox
function edit_prod_OnKeyDown(obj,nChar,bShift,bCtrl,bAlt,LLParam,HLParam)
{
if( nChar == 13 ) // ‘Enter’ Key를 입력하면
{
edit_name.SetFocus(); // 다음 EditBox로 Focus 이동
}
}
// 작업자 EditBox
function edit_name_OnFocus(obj)
{
Grid_name.Visible = true;
Grid_name.SetFocus();
}
// Grid Key처리
function Grid_name_OnKeyDown(obj,nChar,bShift,bCtrl,bAlt,LLParam,HLParam)
{
if( nChar == 13 )
{
Grid_name.Visible = false;
edit_name.Value = ds_man.GetColumn(ds_man.Row, "name");
edit_date.SetFocus();
}
}
// 생산일 EditBox
function edit_date_OnKeyDown(obj,nChar,bShift,bCtrl,bAlt,LLParam,HLParam)
{
if( nChar == 13 )
{
edit_prod.SetFocus();
}
}
// 저장 Button에 해당하는 처리 (어느상태에서나 먹어야하니까 form에 이벤트줘)
function form_key_move_OnKeyDown(obj,senderobj,nChar,bShift,bControl,bAlt,LLParam,HLParam)
{
if( nChar == 113 )
alert("저장완료");
}
2) Component 이동
// "==><=="
function btn2_1_OnClick(obj)
{
Edit2.Width = 100; // Edit Box의 Width를 줄입니다.
}
// "<====>"
function btn2_2_OnClick(obj)
{
Edit2.Width = 300;
}
// "====>"
function btn2_3_OnClick(obj)
{
// Edit0.Left = 300;
Edit2.MoveWindow(300,Edit2.Top, Edit2.Width, Edit2.Height); // Edit Box를 이동합니다.
}
> Master/Detail 처리방법 (tip_master_datail.xml)
1) 아파트 관리
Master/Detail Dataset만들고(Detail에 relation column반드시 만들어야해)
모든 동정보를 가져오고.
이벤트 걸어 필터조건을 가변으로 줘. (동 Grid OnCellClick event) // 동 Grid Click
function Grid_dong_OnCellClick(obj,nRow,nCell,nX,nY)
{
var filter_str;
filter_str = "dong = '" + ds_dong.GetColumn(nRow, "name") + "'";
//alert(filter_str);
ds_ho.Filter(filter_str); // Filtering처리
}
// Form Loading시 처리
function form_master_detail_OnLoadCompleted(obj)
{
Grid_dong_OnCellClick(obj,ds_dong.Row,0,0,0);
}
2) Combo에서의 활용
// 동 Combo Click
function Combo_dong_OnChanged(obj,strCode,strText,nOldIndex,nNewIndex)
{
Grid_dong_OnCellClick(Grid_dong,nNewIndex,0,0,0);
Combo_ho.Index = 0;
}
> Dialog사용시 Argument 및 Return처리 (tip_modal.xml)
grid [Edit(e) : expand] - Grid에 expand버튼 나오게
OnExpandEdit or OnExpandUp 사용
// Grid ExpandEdit Click
function Grid_modal_OnExpandEdit(obj,nRow,nCell,curval)
{
// argument구분자 : ' '
var argument;
var ret_str;
// Dialog로 넘어갈 Argument ( 변수명=변수값 변수명=변수값…)
argument =
"company=" +
ds_modal.GetColumn(ds_modal.Row,"company");
ret_str = Dialog("Tip::tip_modal_child.xml", argument, 450, 300, false, 100, 100); // Dialog Popup
if( ret_str != "" ) // Return String처리
{
var arr;
arr = Split2(ret_str, " ", "=");
ds_modal.SetColumn(ds_modal.Row, "name", arr[0][1]);
ds_modal.SetColumn(ds_modal.Row, "dept", arr[1][1]);
ds_modal.SetColumn(ds_modal.Row, "jikgup", arr[2][1]);
ds_modal.SetColumn(ds_modal.Row, "tel", arr[3][1]);
}
}
Child 처리.
// var company; // 선언해도 동작됨
// OnLoad처리 == 회사명 처리
function form_modal_child_OnLoadCompleted(obj)
{
var filter_str;
// 변수가 없으면 그냥 Return
if( IsExistVar("company") == false )
return;
static_company.Text = company; // Argument는 자동 Parsing 및 값 설정됨
filter_str = "company = '" + company + "'";
ds_modal_child.Filter( filter_str );
}
// 확인 Button
function btn_ok_OnClick(obj)
{
var ret_str;
// return값 생성
ret_str = "name=" + ds_modal_child.GetColumn(ds_modal_child.Row, "name") + " ";
ret_str += "dept=" + ds_modal_child.GetColumn(ds_modal_child.Row, "dept") + " ";
ret_str += "jikgup=" + ds_modal_child.GetColumn(ds_modal_child.Row, "jikgup") + " ";
ret_str += "tel=" + ds_modal_child.GetColumn(ds_modal_child.Row, "tel");
Close(ret_str); // Dialog닫으면서, Return String전달
}
// 취소 Button
function btn_cancel_OnClick(obj)
{
Close("");
}
// Grid Double CLick처리
function Grid_modal_child_OnCellDblClick(obj,nRow,nCell,nX,nY)
{
btn_ok_OnClick(obj);
}
> Parent/Child 처리방법 (tip_pc_parent.xml)
1) Child 화면 제어
(1) Division이 Child일 경우
- Devision ID를 사용하여 제어.
(2) Popup창이 Child일 경우
- Popup창의 Form ID를 사용하여 제어.
2) Parent 화면 제어
-. parent object 사용
tip_pc_parent
// "Child Func Call" Button
function btn_child_func_OnClick(obj)
{
div_child.fn_child(edit_parent.Text); // child function 바로 호출
}
// "Set Child" Button
function btn_set_child_OnClick(obj)
{
div_child.edit_child.Text = edit_parent.Text; // child component 설정
}
tip_child
// Parent에서 호출함 함수
function fn_child(arg) // parent에서 호출할 child function
{
edit_child.Text = arg;
}
// "Set Parent" Button
function btn_set_parent_OnClick(obj)
{
parent.edit_parent.Text = edit_child.Text;
}
// "Popup" Button
function btn_popup_OnClick(obj)
{
open("Tip::tip_pc_popup.xml", 100,100,true, 300,100);
}
// "Set Child" Button
function btn_set_child_OnClick(obj)
{
Form_pc_popup.edit_popup.Text = edit_popup.Text; // Popup창의 Component 설정
}
tip_popup
// "Set Parent" Button
function btn_set_parent_OnClick(obj)
{
parent.edit_popup.Text = edit_popup.Text; // parent에 값 설정
parent.parent.edit_parent.Text = edit_popup.Text;
}
참고사항
Child화면에 Dataset이 없지만 Binding이 된다. MiPlatform은 현재 화면에 Dataset이 없으면 상위화면으로 자동으로 찾아가서 Dataset을 찾는다.
Global Dataset까지 추적한다. 이를 응용하면 Main화면에 Code Data를 두고 Child화면에는 Service호출 없이 Main화면의 Dataset을 이용하면 된다는 뜻.
'MiPlatform' 카테고리의 다른 글
MiPlatform - Chapter8. 운영 (0) | 2012.08.08 |
---|---|
MiPlatform - Chapter7. 고급기능 및 Tip(2) (0) | 2012.08.08 |
MiPlatform - Chapter7. 고급기능 및 Tip(1) (0) | 2012.08.08 |
MiPlatform - Chapter6. Component별 주요기능(2-3) (0) | 2012.08.07 |
MiPlatform - Chapter6. Component별 주요기능(2-2) (0) | 2012.08.07 |