I want to know how to edit grid cells..

Started by mycino, April 22, 2010, 02:13:01 AM

Previous topic - Next topic

mycino

Well, I want to ask you guys about edit grid cellls..

I added up a picture of them.

How can i edit grid cells by keyboard?

I will added up my lisp source ..

please tell me




(defun c:EDIT_TABLE (/ )

(command "opendcl")
(dcl_Project_Load "Mapatt" t)
(dcl_form_Show MapAtt_attDATA)

);속성 편집방법 선택

(defun c:MapAtt_attDATA_OnInitialize (/)
(dcl_Control_SetEventInvoke MapAtt_attDATA 1 )
(dcl_Control_SetEventInvoke MapAtt_attDATA_exit 1)
(dcl_Control_SetEventInvoke MapAtt_attDATA_SelObj 1)
(dcl_Control_SetEventInvoke MapAtt_attDATA_InputClear 1)
(dcl_Control_SetEventInvoke MapAtt_attDATA_singleObj 1)
(dcl_Control_SetEventInvoke MapAtt_attDATA_mutlipleObj 1)
(dcl_Control_SetEventInvoke MapAtt_attDATA_LayersObj 1)
(dcl_Control_SetEventInvoke MapAtt_attDATA_BlankObj 1)
);OD테이블 편집.하기메뉴들 초기화.

(defun c:MapAtt_attDATA_SelObj_OnClicked (/ singleIdx MulIdx LayerIdx BlnkIdx singleTbl MulTbl LayerTbl obj singlelist mulist layerlist)
(setq singleIdx (rtos (dcl_Control_GetValue MapAtt_attDATA_singleObj) 2 0))
(setq  MulIdx (rtos (dcl_Control_GetValue MapAtt_attDATA_mutlipleObj) 2 0))
(setq LayerIdx (rtos (dcl_Control_GetValue MapAtt_attDATA_LayersObj) 2 0))
(setq BlnkIdx (rtos (dcl_Control_GetValue MapAtt_attDATA_BlankObj) 2 0))
(dcl_Grid_Clear MapAtt_attDATA_ODEdit)
  (dcl_Control_SetText MapAtt_attDATA_SeletedTable "객체선택중입니다" )
  (repeat (dcl_Grid_GetColumnCount MapAtt_attDATA_ODEdit)
     (dcl_Grid_DeleteColumn MapAtt_attDATA_ODEdit 0)
     );repeat
   
(cond
  ((= singleIdx "1")
(progn
     (setq obj (car (entsel)))
     (setq singleTbl (car (ade_odgettables obj)))
     (setq singlelist (get_OD_list obj))
     (dcl_Control_SetText MapAtt_attDATA_SeletedTable  singleTbl )
     (dcl_Grid_AddColumns MapAtt_attDATA_ODEdit (list (list "필드이름" 1 130.0 )) )
     (dcl_Grid_AddColumns MapAtt_attDATA_ODEdit (list (list "필드속성값" 1 90.0 )) )
     (dcl_Grid_FillList MapAtt_attDATA_ODEdit singlelist)    
    );progn
    );single객체종료.
  ((= MulIdx "1")
       (progn
     
        ))
   
  ((= LayerIdx "1")
       (progn
     
         ))

          
  ((= BlnkIdx "1")
       (progn
     
       ))   

);END COND객체선택---단일 또는 복수또는 레이어별.또는 빈테이블별
)


(defun c:MapAtt_attDATA_exit_OnClicked (/)
(dcl_Form_Close MapAtt_attDATA );폼닫기.
)

(defun c:MapAtt_attDATA_ODEdit_OnBeginLabelEdit (Row  Column /)
(dcl_Grid_StartCellEdit MapAtt_attDATA_ODEdit Row Column)
)



;-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;체크박스 선택사항소스부분.
(defun c:MapAtt_attDATA_singleObj_OnClicked (Value / singleCheck)
(setq singlecheck (rtos (dcl_Control_GetValue MapAtt_attDATA_singleObj) 2 0))
(cond
((= singlecheck "0")
(progn
(dcl_Control_SetEnabled MapAtt_attDATA_mutlipleObj t) ;복수객체체크박스활성화
(dcl_Control_SetEnabled MapAtt_attDATA_LayersObj t) ;레이어객체체크박스 활성화
(dcl_Control_SetEnabled MapAtt_attDATA_BlankObj t) ;빈테이블선택체크박스 활성화
));singlecheck "0"일때 켜기..
((= singlecheck "1")
(progn
(dcl_Control_SetEnabled MapAtt_attDATA_mutlipleObj "not set") ;복수객체체크박스활성화
(dcl_Control_SetEnabled MapAtt_attDATA_LayersObj "not set") ;레이어객체체크박스 활성화
(dcl_Control_SetEnabled MapAtt_attDATA_BlankObj "not set") ;빈테이블선택체크박스 활성화
));singlecheck"1"일때 끄기
);end cond

);단일객체선택시

(defun c:MapAtt_attDATA_mutlipleObj_OnClicked (Value  / Mulcheck)
(setq Mulcheck (rtos (dcl_Control_GetValue MapAtt_attDATA_mutlipleObj) 2 0))
(cond
((= Mulcheck "0")
(progn
(dcl_Control_SetEnabled MapAtt_attDATA_singleObj t) ;싱글객체체크박스활성화
(dcl_Control_SetEnabled MapAtt_attDATA_LayersObj t) ;레이어객체체크박스 활성화
(dcl_Control_SetEnabled MapAtt_attDATA_BlankObj t) ;빈테이블선택체크박스 활성화
));Mulcheck "0"일때 켜기..
((= Mulcheck  "1")
(progn
(dcl_Control_SetEnabled MapAtt_attDATA_singleObj "not set") ;싱글객체체크박스활성화
(dcl_Control_SetEnabled MapAtt_attDATA_LayersObj "not set") ;레이어객체체크박스 활성화
(dcl_Control_SetEnabled MapAtt_attDATA_BlankObj "not set") ;빈테이블선택체크박스 활성화
));Mulcheck "1"일때 끄기
);end cond
);복합객체 선택시

(defun c:MapAtt_attDATA_LayersObj_OnClicked (Value  / layersCheck)
(setq layersCheck (rtos (dcl_Control_GetValue MapAtt_attDATA_LayersObj) 2 0))
(cond
((= layersCheck "0")
(progn
(dcl_Control_SetEnabled MapAtt_attDATA_mutlipleObj t) ;복수객체체크박스활성화
(dcl_Control_SetEnabled MapAtt_attDATA_singleObj t) ;싱글객체체크박스 활성화
(dcl_Control_SetEnabled MapAtt_attDATA_BlankObj t) ;빈테이블선택체크박스 활성화
));layersCheck "0"일때 켜기..
((= layersCheck "1")
(progn
(dcl_Control_SetEnabled MapAtt_attDATA_mutlipleObj "not set") ;복수객체체크박스활성화
(dcl_Control_SetEnabled MapAtt_attDATA_singleObj "not set") ;싱글객체체크박스 활성화
(dcl_Control_SetEnabled MapAtt_attDATA_BlankObj "not set") ;빈테이블선택체크박스 활성화
));layersCheck  "1"일때 끄기
);end cond
);레이어별 객체선택시



(defun c:MapAtt_attDATA_BlankObj_OnClicked (Value  / BlankCheck)

(setq BlankCheck (rtos (dcl_Control_GetValue MapAtt_attDATA_BlankObj) 2 0))
(cond
((= BlankCheck  "0")
(progn
(dcl_Control_SetEnabled MapAtt_attDATA_mutlipleObj t) ;복수객체체크박스활성화
(dcl_Control_SetEnabled MapAtt_attDATA_singleObj t) ;싱글객체체크박스 활성화
(dcl_Control_SetEnabled MapAtt_attDATA_layersObj t) ;레이어별선택체크박스 활성화
));lBlankCheck "0"일때 켜기..
((= BlankCheck  "1")
(progn
(dcl_Control_SetEnabled MapAtt_attDATA_mutlipleObj "not set") ;복수객체체크박스활성화
(dcl_Control_SetEnabled MapAtt_attDATA_singleObj "not set") ;싱글객체체크박스 활성화
(dcl_Control_SetEnabled MapAtt_attDATA_layersObj "not set") ;레이어별선택체크박스 활성화
));BlankCheck "1"일때 끄기
);end cond
);레이어별 객체선택시
;체크박스선택사항 판별 소스종료.
;-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

(defun AM_GetTableRecord ( ename TableNaclrnrme recNum / Tables ColLst NumRecs ColDef Col)

(setq
   Tables (AM_GetTables ename)
   ColLst '()
)

(if Tables
(progn
   (if (member TableName Tables)
   (progn
      (setq NumRecs (ade_odrecordqty ename TableName))
      (if (< recNum NumRecs)
      (progn
         (setq ColDef (AM_GetTableFormat TableName))
         (if ColDef
         (progn
            (setq ColDef (mapcar 'car ColDef))
            (foreach Col ColDef
               (setq ColLst (cons (ade_odgetfield ename TableName Col recNum) ColLst))
            )
            (setq ColLst (reverse ColLst))
         ))
      ))
   ))
))
ColLst
)


(defun AM_GetTables( ename / Tables )
(setq Tables (ade_odgettables ename))
(if Tables
(progn
   (if (not (listp Tables))
      (setq Tables (list Tables))
   )
   (setq Tables (mapcar 'strcase Tables))
   (setq Tables (reverse Tables))
))
Tables
)

(defun get_OD_list (en_OD / cnt_rec fld fld_list name_list rec_num OD_Table_list table_def val_list)
(if (setq OD_Table_list (ade_odgettables en_OD))
(progn
(foreach OD_Table OD_Table_list
(setq table_def (ade_odtabledefn OD_Table)
fld_list (cdr (nth 2 table_def))
)
(foreach fld fld_list
(setq name_list (append name_list (list (cdr (nth 0 fld)))))
);foreach field in list
(setq rec_num (ade_odrecordqty en_OD OD_Table) cnt_rec 0)
(while (< cnt_rec rec_num)
(foreach fld name_list
(setq val_list
(append val_list (list (list fld (ade_odgetfield en_OD OD_Table fld cnt_rec))))
)
);foreach field in list
(setq cnt_rec (1+ cnt_rec))
);while
);foreach
);pr
);if OD tables attached to entity
val_list
);get_OD_list




Fred Tomke

Hello,
my advice is to use events like OnSelChanged to notice whenever an editable cell is selected to call StartCellEdit and to use OnCancelClose to end up editing the currently selected cell and to select the next editable cell. As far as I remember there was already a topic about that.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Fred Tomke

Additionally I can advice you to use OnKeyDown event for a certain key (like F2) to start editing.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]