(defun c:xlsfmt_to_OnDragnDropFromControl
(ProjectName FormName ControlName DropPoint / rc dpi)
;; get screen resolution
(setq dpi
(vl-registry-read
"HKEY_CURRENT_USER\\Control Panel\\Desktop\\WindowMetrics"
"AppliedDPI"
)
)
(if (< 96 dpi)
;; the difference in resolution of a 1080p monitor and anything else is calculated
;; say 1080p @ 100% = 96 dpi, 3840 x 2160 @ 150% = 144 dpi
;; 96 / 144 = 0.66667 which is the scaling factor applied to DropPoint
(setq DropPoint
(mapcar '(lambda (x) (roundval (* (/ (float 96) (float dpi)) x) 1))
DropPoint
)
)
;; otherwise do nothing
)
;; HitPointTest then reports the correct relative coordinates
(setq rc (dcl_ListView_HitPointTest xlsfmt_to (car DropPoint) (cadr DropPoint)))
; do something with rc ...
) ; end defun
(defun RoundVal (value to)
(setq to (abs to))
(* to
(fix (/ ((if (minusp value)
-
+
)
value
(* to 0.5)
)
to
)
)
)
)
Quote from: domenicomaria on February 07, 2024, 09:29:26 AM(defun =><= (valx start-val end-val) (and (>= valx start-val) (<= valx end-val)))
(if(=><= col-no 0 7)
(dcl-combobox-setcursel ctrl-name (+ col-no 1) )
(progn
(dcl-ComboBox-AddColor ctrl-name col-no)
(dcl-combobox-setcursel ctrl-name 0)
)
)
this works
(defun DCL-COMBOBOX-COLOR-INIT ( ctrl-name col-no / col-pos )
(if(not (setq col-pos (dcl-ComboBox-FindColor ctrl-name col-no) ) )
(progn
(dcl-ComboBox-AddColor ctrl-name col-no )
(setq col-pos (dcl-ComboBox-FindColor ctrl-name col-no) )
)
)
(dcl-combobox-setcursel ctrl-name col-pos )
)