/****************************************************************************
 * @source      :
 * @description :
 ****************************************************************************
 * DATE         AUTHOR    DESCRIPTION
 * --------------------------------------------------------------------------
 * 2011/12/24   정승호    최초작성
 *
 ****************************************************************************/
//---------------------------------------------------------------------------

#include <vcl.h>
#include "ITSSkinF.h"
#include "ITSUtilF.h"
#include "AppGlobalF.h"
#include "CDSCodeF.h"
#include "CDSFacilityF.h"
#include "XiMapUtilF.h"
#pragma hdrstop

#include "AVIM010MF.h"

//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "cxButtons"
#pragma link "cxCalendar"
#pragma link "cxContainer"
#pragma link "cxControls"
#pragma link "cxDropDownEdit"
#pragma link "cxEdit"
#pragma link "cxGraphics"
#pragma link "cxGroupBox"
#pragma link "cxLabel"
#pragma link "cxLookAndFeelPainters"
#pragma link "cxLookAndFeels"
#pragma link "cxMaskEdit"
#pragma link "cxPC"
#pragma link "cxPCdxBarPopupMenu"
#pragma link "cxSpinEdit"
#pragma link "cxSplitter"
#pragma link "cxTextEdit"
#pragma link "cxTimeEdit"
#pragma link "dxSkinBlack"
#pragma link "dxSkinBlue"
#pragma link "dxSkinCaramel"
#pragma link "dxSkinCoffee"
#pragma link "dxSkinDarkRoom"
#pragma link "dxSkinDarkSide"
#pragma link "dxSkinFoggy"
#pragma link "dxSkinGlassOceans"
#pragma link "dxSkiniMaginary"
#pragma link "dxSkinLilian"
#pragma link "dxSkinLiquidSky"
#pragma link "dxSkinLondonLiquidSky"
#pragma link "dxSkinMcSkin"
#pragma link "dxSkinMoneyTwins"
#pragma link "dxSkinOffice2007Black"
#pragma link "dxSkinOffice2007Blue"
#pragma link "dxSkinOffice2007Green"
#pragma link "dxSkinOffice2007Pink"
#pragma link "dxSkinOffice2007Silver"
#pragma link "dxSkinOffice2010Black"
#pragma link "dxSkinOffice2010Blue"
#pragma link "dxSkinOffice2010Silver"
#pragma link "dxSkinsCore"
#pragma link "dxSkinscxPCPainter"
#pragma link "dxSkinSeven"
#pragma link "dxSkinSharp"
#pragma link "dxSkinSilver"
#pragma link "dxSkinStardust"
#pragma link "cxRadioGroup"
#pragma link "cxClasses"
#pragma link "cxCustomData"
#pragma link "cxData"
#pragma link "cxDataStorage"
#pragma link "cxDBData"
#pragma link "cxFilter"
#pragma link "cxGrid"
#pragma link "cxGridCustomTableView"
#pragma link "cxGridCustomView"
#pragma link "cxGridDBTableView"
#pragma link "cxGridLevel"
#pragma link "cxGridTableView"
#pragma link "cxStyles"
#pragma link "FRAME_GisMapF"
#pragma link "cxCheckBox"
#pragma link "FRAME_AviListF"
#pragma resource "*.dfm"

TAVIM010M *AVIM010M = NULL;
//---------------------------------------------------------------------------
__fastcall TAVIM010M::TAVIM010M(TComponent* Owner)
    : TForm(Owner)
{
    ITSSkin_Load(this);
    CMM_LoadForm(g_sFormsDir, this);

    FUpdate= false;
    FTitle = "AVI-제어기 관리";
    FRAMEAviList1->PnlTop->Visible = false;
    FRAMEAviList1->PnlBottom->Visible = false;
    FRAMEAviList1->ColumnSel->Visible = false;
    FRAMEAviList1->Column02->Visible = false;
    FRAMEGisMap1->LbDef->Caption = "(선택메뉴를 클릭하여 위치를 선택합니다.)";
    FRAMEGisMap1->LbDef->Hint = FRAMEGisMap1->LbDef->Caption;

    m_pGDC = FRAMEAviList1->TvList->DataController;
}
//---------------------------------------------------------------------------

/*
 * 닫기버튼 이나 x버튼 클릭시 공통으로 처리하는 로직이들어간다..
 * Form과 DataModule class를 delete시킨다.
 *  arguments
 *
 *  return
 *      void
 */
void __fastcall TAVIM010M::CommClose()
{
    try
    {
        CMM_SaveForm(g_sFormsDir, this);
    }
    catch(...)
    {
    }
}
//---------------------------------------------------------------------------

/*
 * Form을 보여줄때 호출되는 event 메서드이다.
 *  arguments
 *      Sender : event handler 객체
 *  return
 *      void
 */
void __fastcall TAVIM010M::FormShow(TObject *Sender)
{
    Refresh();

    FormInit();
    ChangeEditMode(1);
    TmrShow->Enabled = true;
}
//---------------------------------------------------------------------------

/*
 * form 초기화
 *
 *  arguments
 *
 *  return
 *      void
 */
void __fastcall TAVIM010M::FormInit()
{
    EdId->Text                  = "";
    EdAVI_CTLR_MNGM_NMBR->Text  = "";
    EdAVI_ID->Text              = "";
    EdLINK_ID->Text             = "";
    EdAVI_LCTN_NM->Text         = "";
    CbAVI_VALD_YN->Text         = "";
    EdAVI_CTLR_IP->Text         = "";
    EdAVI_CTLR_CMNC_PORT->Text  = "";
    CbAVI_MAIN_CTLR_YN->Text    = "";
    SeAVI_MNGM_LANE_NUM->Value  = 0;
    SeAVI_CMRA_NUM->Value       = 0;
    SeAVI_DTCT_NUM->Value       = 0;
    EdAVI_DTCT_NM->Text         = "";
    SeAVI_CLCT_CYCL->Value      = 0;
    CbAVI_LAMP_AUTO_YN->Text    = "";
    EdAVI_LAMP_ON_HMS->Text     = "";
    EdAVI_LAMP_OFF_HMS->Text    = "";
    CbAVI_LAMP_ON_YN->Text      = "";
    SeX_CRDN->Value             = 0;
    SeY_CRDN->Value             = 0;
    EdRMRK->Text                = "";

    TXiMapUtil::ClearPath(FRAMEGisMap1->xclntMap);

    FNewDb = false;
}
//---------------------------------------------------------------------------

/*
 * Form이 Show되고 난 후 최초 1회 수행되는 타이머 이벤트
 *  arguments
 *      Sender : event handler 객체
 *  return
 *      void
 */
void __fastcall TAVIM010M::TmrShowTimer(TObject *Sender)
{
    TmrShow->Enabled = false;

    FRAMEGisMap1->LinkLevel = 1;
    FRAMEGisMap1->LoadGisMap();
    //FRAMEGisMap1->ShowHideTrafficLayer(false);
    UpdateAviIcon();

    FRAMEAviList1->UpdateList();
}
//---------------------------------------------------------------------------

/*
 * Close 버튼 클릭 이벤트 핸들러
 *  arguments
 *      Sender : event handler 객체
 *  return
 *      void
 */
void __fastcall TAVIM010M::BtnCloseClick(TObject *Sender)
{
    Close();
}
//---------------------------------------------------------------------------

void __fastcall TAVIM010M::FormClose(TObject *Sender, TCloseAction &Action)
{
    CommClose();
    AVIM010M = NULL;
    Action = caFree;
}
//---------------------------------------------------------------------------

void __fastcall TAVIM010M::FormCloseQuery(TObject *Sender, bool &CanClose)
{
    if (FUpdate)
    {
        POST_MSG(Application->MainForm->Handle, WM_DATABASE_REFRESH, WP_MSG_14, 0);
    }

    FRAMEAviList1->OnCloseQuery(CanClose);
}
//---------------------------------------------------------------------------

void __fastcall TAVIM010M::DisplayInfo(TItsAvi* AObj)
{
    FormInit();

    if (!AObj) return;

    EdId->Text                  = AObj->AVI_CTLR_MNGM_NMBR;
    EdAVI_CTLR_MNGM_NMBR->Text  = AObj->AVI_CTLR_MNGM_NMBR;
    EdAVI_ID->Text              = AObj->AVI_ID;
    EdLINK_ID->Text             = AObj->LINK_ID;
    EdAVI_LCTN_NM->Text         = AObj->AVI_LCTN_NM;
    CbAVI_VALD_YN->Text         = AObj->AVI_VALD_YN;
    EdAVI_CTLR_IP->Text         = AObj->AVI_CTLR_IP;
    EdAVI_CTLR_CMNC_PORT->Text  = AObj->AVI_CTLR_CMNC_PORT;
    CbAVI_MAIN_CTLR_YN->Text    = AObj->AVI_MAIN_CTLR_YN;
    SeAVI_MNGM_LANE_NUM->Value  = AObj->AVI_MNGM_LANE_NUM.ToIntDef(0);
    SeAVI_CMRA_NUM->Value       = AObj->AVI_CMRA_NUM.ToIntDef(0);
    SeAVI_DTCT_NUM->Value       = AObj->AVI_DTCT_NUM.ToIntDef(0);
    EdAVI_DTCT_NM->Text         = AObj->AVI_DTCT_NM;
    SeAVI_CLCT_CYCL->Value      = AObj->AVI_CLCT_CYCL.ToIntDef(0);
    CbAVI_LAMP_AUTO_YN->Text    = AObj->AVI_LAMP_AUTO_YN;
    EdAVI_LAMP_ON_HMS->Text     = AObj->AVI_LAMP_ON_HMS;
    EdAVI_LAMP_OFF_HMS->Text    = AObj->AVI_LAMP_OFF_HMS;
    CbAVI_LAMP_ON_YN->Text      = AObj->AVI_LAMP_ON_YN;
    SeX_CRDN->Value             = StrToFloatDef(AObj->X_CRDN, 0);
    SeY_CRDN->Value             = StrToFloatDef(AObj->Y_CRDN, 0);
    EdRMRK->Text                = AObj->RMRK;

    FRAMEGisMap1->SelectObjectByPos(SeX_CRDN->Value, SeY_CRDN->Value, true);

    ChangeEditMode(3);
}
//---------------------------------------------------------------------------

void __fastcall TAVIM010M::FRAMEGisMap1xclntMapMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y)
{
    if (EdId->Properties->ReadOnly) return;

    if (Button != mbLeft) return;
    if (FRAMEGisMap1->xclntMap->MapOperation != OnSelect) return;

    FRAMEGisMap1->xclntMap->SetFocus();

    TXiMapUtil::ClearPath(FRAMEGisMap1->xclntMap);

    String sLinkId;
    int nLayerIdx = FRAMEGisMap1->GetLayerIndex();
    if (nLayerIdx >= 0)
    {
        TXiMapUtil::SelectLinkByPos(FRAMEGisMap1->xsrvrMap, FRAMEGisMap1->xclntMap, nLayerIdx, X, Y, sLinkId);
        if (!sLinkId.IsEmpty())
        {
            EdLINK_ID->Text = sLinkId;
        }
    }

	TDDPoint dptCurr = FRAMEGisMap1->xclntMap->ScreenToReal(Point( X, Y));

    try {
        SeX_CRDN->Value = dptCurr.X;
        SeY_CRDN->Value = dptCurr.Y;
    } catch(...) {}
}
//---------------------------------------------------------------------------

void __fastcall TAVIM010M::UpdateAviIcon()
{
	FRAMEGisMap1->xclntMap->ClearCCTVEvent(true);

    TItsFacility *pFacility;
    try
    {
        if (ChkViewIcon->Checked)
        {
            try
            {
                FRAMEAviList1->MyItsAviManager->FLists.Lock();
                FOR_STL(TItsAvi*, pObj, FRAMEAviList1->MyItsAviManager->FLists)
                {
                    if (pObj->DEL_YN == "Y") continue;

                    //pFacility = FRAMEAviList1->MyItsAviManager->FLists.Find(pObj->AVI_ID);
                    //if (!pFacility) continue;

                    try {
                    String sTitle = "▶▶AVI-제어기 정보◀◀|AVI ID : " + pObj->AVI_ID + "|명칭 : " + pObj->AVI_LCTN_NM;
                    FRAMEGisMap1->xclntMap->ADDCCTVEvent(DDPoint(StrToFloatDef(pObj->X_CRDN, 0), StrToFloatDef(pObj->Y_CRDN, 0)), pObj->AVI_ID, "AVI", sTitle, 9, 1, 7);
                    } catch(...) { }
                }
            }
            __finally
            {
                FRAMEAviList1->MyItsAviManager->FLists.UnLock();
            }
        }
    }
    catch(...)
    {
    }

	FRAMEGisMap1->xclntMap->ReDraw();
}
//---------------------------------------------------------------------------

void __fastcall TAVIM010M::FRAMEAviList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
          TMouseButton AButton, TShiftState AShift, bool &AHandled)
{
	if (!ACellViewInfo) return;
	int nRow = FRAMEAviList1->TvList->DataController->FocusedRecordIndex;
	if( nRow <= -1 )
		return;

    int nMemPtr = FRAMEAviList1->TvList->DataController->Values[nRow][FRAMEAviList1->Column99->Index];
    TItsAvi* pObj = (TItsAvi*)nMemPtr;
    DisplayInfo(pObj);
}
//---------------------------------------------------------------------------

void __fastcall TAVIM010M::ChkViewIconClick(TObject *Sender)
{
    UpdateAviIcon();
}
//---------------------------------------------------------------------------

void __fastcall TAVIM010M::BtnEditClick(TObject *Sender)
{
    if (BtnEdit->Caption == "편집")
    {
        ChangeEditMode(0);
        FNewDb = false;
    }
    else
    {
        String sId = EdId->Text;
        ChangeEditMode(1);

        TItsAvi *pObj = FRAMEAviList1->MyItsAviManager->FLists.Find(sId);
        if (pObj)
        {
            CMM_SetGridRow(FRAMEAviList1->CxList, FRAMEAviList1->TvList, sId, FRAMEAviList1->Column01->Index);
            DisplayInfo(pObj);
        }
    }
}
//---------------------------------------------------------------------------

void __fastcall TAVIM010M::ChangeEditMode(int AEdit)
{
    bool bEnabled = false;
    switch(AEdit)
    {
    case 0: //편집버튼클릭
        {
            BtnEdit->Enabled = true;
            BtnInsert->Enabled = false;
            BtnDelete->Enabled = false;
            BtnSave->Enabled = true;

            BtnEdit->Caption = "취소";
            BtnEdit->Hint    = "데이터 편집 취소";
        }
        break;
    case 1: //편집[취소]버튼클릭
        {
            FormInit(); //화면을 모두 지운다.
            BtnEdit->Enabled = false;
            BtnInsert->Enabled = true;
            BtnDelete->Enabled = false;
            BtnSave->Enabled = false;

            BtnEdit->Caption = "편집";
            BtnEdit->Hint    = "데이터 편집";
            bEnabled = true;
        }
        break;
    case 2: //추가
        {
            BtnEdit->Enabled = true;
            BtnInsert->Enabled = false;
            BtnDelete->Enabled = false;
            BtnSave->Enabled = true;

            BtnEdit->Caption = "취소";
            BtnEdit->Hint    = "데이터 편집 취소";
        }
        break;
    case 3: //수정모드
        {
            BtnEdit->Enabled = true;
            BtnInsert->Enabled = true;
            BtnDelete->Enabled = true;
            BtnSave->Enabled = false;

            BtnEdit->Caption = "편집";
            BtnEdit->Hint    = "데이터 편집";
            bEnabled = true;
        }
        break;
    }

    if (AEdit == 0 || AEdit == 2)
    {
        FRAMEAviList1->CxList->Enabled = false;
    }
    else
    {
        FRAMEAviList1->CxList->Enabled = true;
    }

    EdId->Properties->ReadOnly                  = bEnabled;
    EdAVI_CTLR_MNGM_NMBR->Properties->ReadOnly  = bEnabled;
    EdAVI_ID->Properties->ReadOnly              = bEnabled;
    EdLINK_ID->Properties->ReadOnly             = bEnabled;
    EdAVI_LCTN_NM->Properties->ReadOnly         = bEnabled;
    CbAVI_VALD_YN->Properties->ReadOnly         = bEnabled;
    EdAVI_CTLR_IP->Properties->ReadOnly         = bEnabled;
    EdAVI_CTLR_CMNC_PORT->Properties->ReadOnly  = bEnabled;
    CbAVI_MAIN_CTLR_YN->Properties->ReadOnly    = bEnabled;
    SeAVI_MNGM_LANE_NUM->Properties->ReadOnly   = bEnabled;
    SeAVI_CMRA_NUM->Properties->ReadOnly        = bEnabled;
    SeAVI_DTCT_NUM->Properties->ReadOnly        = bEnabled;
    EdAVI_DTCT_NM->Properties->ReadOnly         = bEnabled;
    SeAVI_CLCT_CYCL->Properties->ReadOnly       = bEnabled;
    CbAVI_LAMP_AUTO_YN->Properties->ReadOnly    = bEnabled;
    EdAVI_LAMP_ON_HMS->Properties->ReadOnly     = bEnabled;
    EdAVI_LAMP_OFF_HMS->Properties->ReadOnly    = bEnabled;
    CbAVI_LAMP_ON_YN->Properties->ReadOnly      = bEnabled;
    SeX_CRDN->Properties->ReadOnly              = bEnabled;
    SeY_CRDN->Properties->ReadOnly              = bEnabled;
    EdRMRK->Properties->ReadOnly                = bEnabled;
}
//---------------------------------------------------------------------------


void __fastcall TAVIM010M::BtnInsertClick(TObject *Sender)
{
    FormInit();

    //신규아이디를 얻어와서 화면을 초기화한다.
    String sId;

#if 0
    if (!FRAMEAviList1->MyItsAviManager->GetNextAviId(sId))
    {
        Application->MessageBox(L"새로운 AVI-제어기 관리번호를 생성하지 못하였습니다.\r\n프로그램 종료후에 다시 시도해 보세요.",
                                FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
        return;
    }
#else
	sId = InputBox("제어기 관리번호", "신규 제어기 관리번호를 입력하세요(20Byte).", "제어기 관리번호" );

    sId = sId.Trim();
	if (sId == "제어기 관리번호" || sId == "")
	{
		return;
	}
	if (AnsiString(sId).Length() > 20)
	{
        Application->MessageBox(L"제어기 관리번호는  20Byte를 초과할 수 없습니다.", FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
		return;
	}

    TItsAvi *pDb = (TItsAvi *)FRAMEAviList1->MyItsAviManager->FLists.Find(sId);
    if (pDb)
    {
        Application->MessageBox(("[" + sId + "]는 사용할 수 없는 제어기 관리번호 입니다.").c_str(), FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
        return;
    }
#endif

    EdId->Text = sId;
    EdAVI_CTLR_MNGM_NMBR->Text = sId;
    ChangeEditMode(2);
    FNewDb = true;
}
//---------------------------------------------------------------------------

void __fastcall TAVIM010M::BtnDeleteClick(TObject *Sender)
{
    int nIdx = m_pGDC->FocusedRecordIndex;
    if (nIdx < 0) return;

    String sId = EdId->Text;

    if (sId.IsEmpty())
    {
        Application->MessageBox(L"삭제할 AVI-제어기를 목록에서 선택하세요.\r\n목록에서 더블클릭하여 선택합니다.", FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
        return;
    }
    String sMsg;
    sMsg = "ID: " + sId;
    sMsg+= "\r\n선택하신 AVI-제어기 정보를 삭제하시겠습니까?";

    if (Application->MessageBox(sMsg.c_str(), FTitle.c_str(), MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL) != IDYES) return;

	TItsAvi *pObj = FRAMEAviList1->MyItsAviManager->FLists.Find(sId);
	if (pObj)
	{
		if (FRAMEAviList1->MyItsAviManager->DeleteAvi(pObj))
		{
            pObj->DEL_YN = "Y";
            FRAMEAviList1->UpdateList();
		}

		TItsFacility *pFacility = ItsFacilityManager->FLists.Find(sId);
        if (pFacility)
        {
            FUpdate = true;
        }

        Application->MessageBox(L"AVI-제어기 정보삭제\r\nAVI-제어기 정보를 삭제 하였습니다.",
                                FTitle.c_str(), MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);

        FormInit();
        ChangeEditMode(1);
	}
}
//---------------------------------------------------------------------------

void __fastcall TAVIM010M::BtnSaveClick(TObject *Sender)
{
	if (EdId->Text.IsEmpty()                ||
        EdAVI_ID->Text.Trim().IsEmpty()     ||
        EdAVI_LCTN_NM->Text.Trim().IsEmpty()||
        SeX_CRDN->Value == 0                ||
        SeY_CRDN->Value == 0                )
	{
        Application->MessageBox(L"★항목은 필수 입력 항목입니다.\r\n모두 입력후 진행해 주세요.",
                                FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
		return;
	}

    String sId = EdId->Text;

    TItsAvi *pObj;
    if (FNewDb)
        pObj = new TItsAvi();
    else
        pObj = FRAMEAviList1->MyItsAviManager->FLists.Find(sId);

    if (pObj)
    {
        pObj->AVI_CTLR_MNGM_NMBR = EdId->Text.Trim();
        pObj->AVI_ID             = EdAVI_ID->Text.Trim();
        pObj->LINK_ID            = EdLINK_ID->Text.Trim();
        pObj->AVI_LCTN_NM        = EdAVI_LCTN_NM->Text.Trim();
        pObj->AVI_VALD_YN        = CbAVI_VALD_YN->Text.Trim();
        pObj->AVI_CTLR_IP        = EdAVI_CTLR_IP->Text.Trim();
        pObj->AVI_CTLR_CMNC_PORT = EdAVI_CTLR_CMNC_PORT->Text.Trim();
        pObj->AVI_MAIN_CTLR_YN   = CbAVI_MAIN_CTLR_YN->Text.Trim();
        pObj->AVI_MNGM_LANE_NUM  = VarToStr(SeAVI_MNGM_LANE_NUM->Value);
        pObj->AVI_CMRA_NUM       = VarToStr(SeAVI_CMRA_NUM->Value);
        pObj->AVI_DTCT_NUM       = VarToStr(SeAVI_DTCT_NUM->Value);
        pObj->AVI_DTCT_NM        = EdAVI_DTCT_NM->Text.Trim();
        pObj->AVI_CLCT_CYCL      = VarToStr(SeAVI_CLCT_CYCL->Value);
        pObj->AVI_LAMP_AUTO_YN   = CbAVI_LAMP_AUTO_YN->Text.Trim();
        pObj->AVI_LAMP_ON_HMS    = EdAVI_LAMP_ON_HMS->Text.Trim();
        pObj->AVI_LAMP_OFF_HMS   = EdAVI_LAMP_OFF_HMS->Text.Trim();
        pObj->AVI_LAMP_ON_YN     = CbAVI_LAMP_ON_YN->Text.Trim();
        pObj->X_CRDN             = VarToStr(SeX_CRDN->Value);
        pObj->Y_CRDN             = VarToStr(SeY_CRDN->Value);
        pObj->RMRK               = EdRMRK->Text.Trim();
        pObj->DEL_YN             = "N";

        pObj->Completed          = true;
        pObj->MEM_DEL            = "N";

        bool bResult;
        if (FNewDb)
        {
            bResult = FRAMEAviList1->MyItsAviManager->InsertAvi(pObj);
            if (bResult)
            {
                FRAMEAviList1->MyItsAviManager->FLists.Push(sId, pObj);
            }
		}
        else
		{
            bResult = FRAMEAviList1->MyItsAviManager->UpdateAvi(pObj);
		}

        if (bResult)
        {
            Application->MessageBox(L"AVI-제어기 정보저장\r\nAVI-제어기 정보를 저장 하였습니다.",
                                    FTitle.c_str(), MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);

            FUpdate = true;

            FRAMEAviList1->UpdateList();
            UpdateAviIcon();
            CMM_SetGridRow(FRAMEAviList1->CxList, FRAMEAviList1->TvList, sId, FRAMEAviList1->Column01->Index);
#if 0
            DisplayInfo(pObj);
#else
            int nRow = FRAMEAviList1->TvList->DataController->FocusedRecordIndex;
            if( nRow <= -1 )
                return;

            int nMemPtr = FRAMEAviList1->TvList->DataController->Values[nRow][FRAMEAviList1->Column99->Index];
            TItsAvi* pObj = (TItsAvi*)nMemPtr;
            DisplayInfo(pObj);
#endif
        }
    }
}
//---------------------------------------------------------------------------

