Message 1 of 9
Image overlays instead of changing

Not applicable
12-11-2020
04:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to create a .dcl, so when I click on an item in the list_box the image on the side will be changed.
because in my role she gets soreposta ??
is this the correct way to deal with it ??
How can I improve and leave the proof of failure ??
(defun c:demo ( )
(defun *error* ( msg )
(and ofile (close ofile))
(or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
(princ (strcat "\n** Error: " msg " **"))
)
(vl-file-delete file)
(princ)
)
(defun :writedcl ( local )
(setq file local)
(setq ofile (open file "w"))
(foreach line
'(
"butt01 : button { width = 15; height = 2; fixed_width = true; alignment = centered; }"
"dcl_test : dialog { label = \" TEST \";"
" spacer;"
": boxed_column"
"{"
": row"
"{"
":list_box { width = 20; height = 10; fixed_width = true; key = \"lst\"; }"
":image { width = 20; height = 10; key = \"img\"; }"
"}"
"}"
"ok_cancel;"
"} //_end"
)
(write-line line ofile)
)
(not (setq ofile (close ofile)))
)
(cond
( (not (:writedcl (setq file (vl-filename-mktemp nil nil ".dcl"))))
(alert "it was not possible to record the dcl")
)
( (<= (setq dcfname (load_dialog file)) 0)
(alert "DCL not found")
)
( (not (new_dialog "dcl_test" dcfname))
(alert "DCL not found")
)
(t
(setq tip '("quad" "figure 1" "figure 2"))
(start_list "lst")
(mapcar 'add_list tip)
(end_list)
(set_tile "lst" "0")
(:vecimagem "img" quad)
(action_tile "lst"
(vl-prin1-to-string
(quote
(:vecimagem "img"
(cond
( (= (nth (atoi $value) tip) "quad")
(setq temp quad)
)
( (= (nth (atoi $value) tip) "figure 1")
(setq temp fig1)
)
( (= (nth (atoi $value) tip) "figure 2")
(setq temp fig2)
)
) ;;cond
)
)
)
)
(if (= (start_dialog) 1)
(alert "Ok!")
(alert "Cancel!")
)
)
)
(if (and file (setq file (findfile file)))(vl-file-delete file))
(princ)
)
(defun :vecimagem ( key lst )
(setq i (/ (dimx_tile key) 289.) j (/ (dimy_tile key) 170.))
(start_image key)
(foreach x lst
(vector_image (fix (* (car x) i))(fix (* (cadr x) j))(fix (* (caddr x) i))(fix (* (cadddr x) j))(last x))
)
(end_image)
(princ)
)
;;vector!!
(setq quad '((11 80 107 80 240) (107 80 107 0 240) (107 0 11 0 240) (11 0 11 80 240)))
(setq fig1 '((11 80 107 80 240) (107 80 107 0 240) (107 0 11 0 240) (11 0 11 80 240) (11 80 59 0 240) (59 0 107 80 240)))
(setq fig2 '((11 80 107 80 240) (107 80 107 0 240) (107 0 11 0 240) (11 0 11 80 240) (11 0 107 80 240) (107 0 11 80 240)))
(c:demo)