do we still need to use "two string" calls for DCL_Form_ when sep. namespaces?

Started by jmaeding, March 19, 2010, 12:29:04 PM

Previous topic - Next topic

jmaeding

Its been so long since I switched to calling things like:
(DCL_Form_IsActive "CT-Civil10" "frmCT-Civil-Mst")
that i forget why I do that.
I recall it was for separate namespace vlx, which is what I always compile to.

The problem I am seeing is I load using (DCL_Project_Load (findfile "CT-Civil10.odcl.lsp")),
then check if a modeless dialog is open, but get an error.
I read that you check if the var exists to avoid calling DCL_Form_IsActive and DCL_Form_Close with nulls,
but its not working.
I am trying:
(IF (OR (NOT (vl-doc-ref 'CT-Civil10_frmCT-Civil-Mst))
  (NOT (DCL_Form_IsActive "CT-Civil10" "frmCT-Civil-Mst")))
;SHOW TOOLBAR
  (DCL_Form_Show "CT-Civil10" "frmCT-Civil-Mst")
)

I'm kind of lost though.
The tasks I need to do are:
1) close a particular dialog if open
2) show a form if not open
what are the recommended ways for current odcl version of 5.1
thanks

jmaeding

I think my code is ok, but i caused problems by a support path acad dropped (that has the odcl.lsp files in it).
So the files got found in folder that has my old dialogs....
I'd still like to know if its better to call using two strings, or the single varname.
thx

Fred Tomke

Hi, jmaeding, I cannot tell you definitely what is better right from the code. Since the variables contain the entities of the controls and forms, it just suggests me to think it should be faster than using separate strings. In old ObjectDCL using strings had the effect that the code was looking for a project file at first with this name in the support path, looking for the form, then for the control... In the sum of many accesses to the form a delay could be recognized. But I don't know anything about the algorithm on OpenDCL when using strings. But maybe it is still the same. Then it could be better to use variables.

Writing code using strings could have one single advantage: In my old ObjectDCL code (I'm just transforming to OpenDCL) I find many places where I used this way:
Code (autolisp) Select
(mapcar '(lambda (strC isVis) (dcl_control_setvisible "MyProj" "MyForm" strC isVis))
            (list "pb_accept" "pb_select" "pb_cancel" "pb_help")
            (list nil nil T T))


Because I want to use variables now I have to rewrite most part of the code. Sometimes I create an additional subfunction to keep most of the old code:
Code (autolisp) Select

(defun control (strC)
  (eval (read (strcat "MyProj_MyForm_" strC)))
); control
[...]
(mapcar '(lambda (strC isVis) (dcl_control_setvisible (control strC) isVis))
            (list "pb_accept" "pb_select" "pb_cancel" "pb_help")
            (list nil nil T T))


Sorry, that I cannot give more detailed information.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

owenwengerd

As far as I know the only good reason to use strings is cases where the string is arrived at programmatically. Using the preset variable name is much more efficient internally.
Owen Wengerd (Outside The Box) / ManuSoft

jmaeding

ah, good info, I think I need to switch then.  I don't build the strings programatically in any case so far.