OpenDCL Forums

OpenDCL => Studio/Dialog Editor => Topic started by: jmaeding on March 16, 2010, 03:38:45 PM

Title: How to change text with odcl api call so its in pixels, not scaled to monitor
Post by: jmaeding on March 16, 2010, 03:38:45 PM
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
Title: Re: How to change text with odcl api call so its in pixels, not scaled to monitor
Post by: jmaeding on March 16, 2010, 03:40:39 PM
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...
Title: Re: How to change text with odcl api call so its in pixels, not scaled to monitor
Post by: BazzaCAD on March 16, 2010, 03:45:33 PM
How's this...
http://www.opendcl.com/HelpFiles/index.php?page=Advanced/Tips.htm (http://www.opendcl.com/HelpFiles/index.php?page=Advanced/Tips.htm)
Title: Re: How to change text with odcl api call so its in pixels, not scaled to monitor
Post by: jmaeding on March 16, 2010, 03:49:53 PM
hmm, I just tried that with no luck, maybe I fooled myself? naahhhh :)
thx for lightning fast reply, let me give it another go
Title: Re: How to change text with odcl api call so its in pixels, not scaled to monitor
Post by: jmaeding on March 16, 2010, 04:04:20 PM
stoked, I was wrong! neg sizes do set to pixels.  Love those easy ones.
thx for the help
Title: Re: How to change text with odcl api call so its in pixels, not scaled to monitor
Post by: jmaeding on March 16, 2010, 04:43:13 PM
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)  
)