muthu123 发表于 2022-7-6 11:15:01

CELL EDIT in a Table -Help

Dear friends,
 
Is it possible to update a cell automatically based on the text edit of one cell.
 
Ex.
If we edit the part in the follwing sample table, the description cell should have the corresponding size of the part.
 
PART      Description
CL-01    "PL5X80X155"
CL-02    "PL6X80X180"
 
Help will be highly appriciatable.
 
Yours,
Muthu.

fixo 发表于 2022-7-6 11:49:12

 
Here is quick and dirty example
test it just after you would finished to edit the desired cells

(defun C:demo(/ columns pair part_list row rows table_ent table_obj);; change your part list here:(setq part_list (list   (cons "CL-01" "PL5X80X155")   (cons "CL-02" "PL6X80X180")   (cons "CL-03" "PL7X80X200")   (cons "CL-04" "PL8X80X240")   (cons "CL-05" "PL9X80X300") )) (setq table_ent (entsel "\nSelect table >> ")) (setq table_obj (vlax-ename->vla-object (car table_ent))) (setq rows (vlax-get-property table_obj 'Rows)) (setq columns (vlax-get-property table_obj 'Columns)) (setq row 0) (if (eq :vlax-false (vla-get-titlesuppressed table_obj))   (progn   (setq row (1+ row))    (setq rows (1- rows)))   ) (if (eq :vlax-false (vla-get-headersuppressed table_obj))       (progn   (setq row (1+ row))    (setq rows (1- rows)))   )   (repeat rows   (if (setq pair(assoc (vla-gettext table_obj row 0) part_list))   (vla-settext table_obj row 1 (cdr pair)))   (setq row (1+ row))) (vla-update table_obj) (princ) )(vl-load-com)
 
~'J'~

muthu123 发表于 2022-7-6 12:01:30

 
Dear fixo,
 
Thank you so much.
Instead of calling separate function, how can we assign this function to that same cell to update automatically depends of the part list.

fixo 发表于 2022-7-6 12:31:24

Search forum how to use vlr-object-reactor
I have not have an experience with this thing
 
~'J'~
页: [1]
查看完整版本: CELL EDIT in a Table -Help