개발메모(형식에 매이지 않는 짤막한 개발 낙서)

글 수 174

컨트롤에 드래그앤드롭할 때의 처리를 위한 메모

조회 수 2848 추천 수 0 2005.10.25 16:36:48
허창원 *.19.45.222
컨트롤에 드래그앤드롭할 때의 처리를 위한 메모(아직은 허창원에게만 해당됩니다. 다른 분들에게는 KDManip.dll 라이브러리에 대한 소개가 된 후에 설명이 제대로 될 내용입니다.)

...common.h 파일에서 ------------------------------------------

extern KD_ControlPosition ContPosition;

...common.c 파일에서 ------------------------------------------

KD_ControlPosition ContPosition;


Initialize_DEFPROG_Before_DisplayPanel() 함수에서 -------------

    // Control Position 초기화
    KD_ControlPosition_Initialize(&ContPosition, 1);
        KD_ControlPosition_AddControl(&ContPosition, panelHandle, PANEL_deco_inputfile);
    //    KD_ControlPosition_AddControl(&ContPosition, panelHandle, PANEL_deco2);


    // 드래그앤 드롭 인에이블
    EnableDragAndDrop (panelHandle);

PanelCB()에서--------------------------------------------------

int CVICALLBACK PanelCB (int panel, int event, void *callbackData,
        int eventData1, int eventData2)
{
    switch (event)
        {
        case EVENT_GOT_FOCUS:

            break;
        case EVENT_LOST_FOCUS:

            break;
        case EVENT_CLOSE:
            QuitUserInterface (0);
            break;
        // 드래그앤드롭 처리-시작
        //This event occurs when files are dragged and dropped on the panel
        case EVENT_FILESDROPPED:
            {
                char** files;
                char*  firstFile;
                int index;

                int xcord, ycord;

                // 마우스의 위치값을 구함
                GetRelativeMouseState (panelHandle, 0, &xcord, &ycord, NULL, NULL, NULL);
                
              
                files = (char**)eventData1;
                //firstFile = files[0];
                
                index=0;
                while(files[index]) // 파일명을 저장하는 문자열 공간이 NULL이 아니라면...
                {
                    if(files[index][0]) /// 파일명이 NULL로 시작하지 않는다면...
                    {
                        int retval;
                        
                        // 파일명만 뽑아냄
                        KD_Extract_Filename_only(files[index], g_KDBuffer);

                        /*
                        retval = KD_ControlPosition_FindControlIndex(&ContPosition, panelHandle, xcord, ycord);
                        
                        if(retval == 0) /// index가 0이면 PANEL_deco1 이므로 PANEL_strFilepath_Cont1에 출력
                        {
                            SetCtrlAttribute(panelHandle, PANEL_strFilepath_Cont1, ATTR_CTRL_VAL, g_KDBuffer);  
                        }
                        else if(retval == 1)    /// index가 1이면 PANEL_deco2 이므로 PANEL_strFilepath_Cont2에 출력
                        {
                            SetCtrlAttribute(panelHandle, PANEL_strFilepath_Cont2, ATTR_CTRL_VAL, g_KDBuffer);  
                        }
                        else    // 둘다 아니면 panel 바탕에 떨어짐
                        {
                            SetCtrlAttribute(panelHandle, PANEL_strFilepath, ATTR_CTRL_VAL, g_KDBuffer);
                        }
                        */
                        
                        retval = KD_ControlPosition_FindControl(&ContPosition, panelHandle, xcord, ycord);
                        
                        if(retval == PANEL_deco1) /// PANEL_deco1 이므로 PANEL_strFilepath_Cont1에 출력
                        {
                            SetCtrlAttribute(panelHandle, PANEL_strFilepath_Cont1, ATTR_CTRL_VAL, g_KDBuffer);  
                        }
                        else if(retval == PANEL_deco2)    /// PANEL_deco2 이므로 PANEL_strFilepath_Cont2에 출력
                        {
                            SetCtrlAttribute(panelHandle, PANEL_strFilepath_Cont2, ATTR_CTRL_VAL, g_KDBuffer);  
                        }
                        else    // 둘다 아니면 panel 바탕에 떨어짐
                        {
                            SetCtrlAttribute(panelHandle, PANEL_strFilepath, ATTR_CTRL_VAL, g_KDBuffer);
                        }

                        //static char Tmp_Buff[30];

                        // 파일의 확장자를 뽑아내서, ".WMV" 혹은 ".wmv"일 때만 리스트 박스에 추가함
                        //KD_Get_FileExtension(files[index], Tmp_Buff);
                        //if(!stricmp(Tmp_Buff, ".wmv"))
                        //{
                        //    // 전체 경로명에서 파일명만 g_KDBuffer로 뽑아냄
                        //    KD_Extract_Filename_only(files[index], g_KDBuffer);
                        //
                        //    // Listbox에 Label과 value를 추가함.
                        //    InsertListItem (panelHandle, PANEL_listboxFileList, -1, g_KDBuffer, files[index]);
                        //}
                        
                    }
                    index++;
                }
            }
            break;
        // 드래그앤드롭 처리-마침
        }
    return 0;
}
List of Articles
번호 제목 글쓴이 날짜 조회 수
74 Noisy Sine Wave 데이터 만들기 허창원 2005-11-24 3307
73 KD Radio Group 콜백함수의 예 허창원 2005-11-04 2965
» 컨트롤에 드래그앤드롭할 때의 처리를 위한 메모 허창원 2005-10-25 2848
71 파일을 text 모드로 열었는데, fread() 함수를 사용했을 때의 문제 허창원 2005-10-25 2932
70 non-SCF style programming을 위한 객체(구조체) 선언 예 허창원 2005-10-20 2844
69 가변인수 메모 허창원 2005-10-14 2958
68 windef.h 파일에 선언된 내용 일부 허창원 2005-09-29 3445
67 디렉토리 내의 파일 검색하여 처리하는 예 허창원 2005-09-22 2802
66 색깔 상수 허창원 2005-09-22 2965
65 Data Type 상수 허창원 2005-09-22 5056
64 List 컨트롤의 List Item을 모두 지울때는 ClearListCtrl()을 허창원 2005-09-15 4862
63 [스크랩] ActiveX and COM 허창원 2005-09-05 4238
62 사용자 대화상자 구현 요약 허창원 2005-08-30 2805
61 Password 컨트롤 사용법 메모 허창원 2005-08-30 3370
60 Radio Group 커스텀 컨트롤을 사용할 때 주의할 점 허창원 2005-08-01 3125
59 프로그램 시작시에 Panel을 최대화하기 허창원 2005-08-01 2851
58 Cannot find icon file. 이라는 에러메시지 허창원 2005-07-23 3321
57 병렬 포트를 이용하기 전에 low level support driver를 항상 체크하기 허창원 2005-07-01 2920
56 mktime함수를 사용할 때, 이 점을 주의... 허창원 2005-06-30 10377
55 윈도 시작시 자동실행하는 프로그램은 레지스트리의 이곳에 허창원 2005-06-10 3061