How to change text with odcl api call so its in pixels, not scaled to monitor

Started by jmaeding, March 16, 2010, 03:38:45 PM

Previous topic - Next topic

jmaeding

I have the code to change all other props, but I don't see the one for pixels/scaled to monitor.
I have to do this for every control I have, several hundred.
advice appreciated, thx

jmaeding

also, why is text height set to negative in the example code I've seen?
I tried that but its not the trigger to use pixels...

BazzaCAD

a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

jmaeding

hmm, I just tried that with no luck, maybe I fooled myself? naahhhh :)
thx for lightning fast reply, let me give it another go

jmaeding

stoked, I was wrong! neg sizes do set to pixels.  Love those easy ones.
thx for the help

jmaeding

and here is my code for doing an entire folder of odcl.lsp type files:
Code (autolisp) Select

(defun c:DoODCL ( / FILE NEWODCLPATH PASSWORD PATH)
 (setq path "C:\\CAD_SUPPORT\\ODCL Files\\")
 (foreach file (vl-directory-files path "*.odcl.lsp" 1)
   (fixsets path file nil)
 )
)

(defun fixsets (path odclfile password / )  
 (setq project (dcl_project_load (strcat path odclfile)))  
 (if (not project)  
   (exit)  
 )  
 (foreach form (dcl_project_getforms project)  
   (foreach control (dcl_form_getcontrols form)
     (progn
       (setq props (dcl_control_getproperties control))
       ;do not do flexgrids, do by hand
       (if (not (member "AllowBigSelection" props))
         (progn  
           ;set all fonts to MS Shell Dlg
           ;(dcl_control_getproperty control "(Name)")
           (if (member "Font" props)
;;;              (IF (vl-catch-all-error-p (vl-catch-all-apply '(lambda () (dcl_control_setproperty control "Font"  "MS Shell Dlg"))))
;;;                (princ)
;;;              )
             (dcl_control_setproperty control "Font"  "MS Shell Dlg")
           )
           ;convert sizes, neg numbers for pixel scaling
           (if (member "FontSize" props)
             (cond
               ((= (abs (dcl_control_getproperty control "FontSize")) 8)
                 (dcl_control_setproperty control "FontSize" -10)
               )
               ((= (abs (dcl_control_getproperty control "FontSize")) 12)
                 (dcl_control_setproperty control "FontSize" -14)
               )
               ;else
               (1
                (dcl_control_setproperty control "FontSize" (* -1 (abs (dcl_control_getproperty control "FontSize"))))
               )
             )
           )
           ;no visual styles
           (if (member "UseVisualStyle" props)  
             (dcl_control_setproperty control "UseVisualStyle" nil)
           )
         )
       )
     )
   )  
 )
 ;save project file
 (dcl_project_saveas project (strcat path "New-" odclfile) password)  
)