What would it take to convert from object dcl to open dcl?

Started by Hypersonic, November 25, 2009, 03:52:56 AM

Previous topic - Next topic

Hypersonic

"lock floating windows" - on attached screen shot, apparently was the culprit! 
I never would have seen that coming..... Thanks for pointing me in the right direction  8)

Hypersonic


Would any of the new open dcl stuff prevent the following from working?  I have a bunch of these types of statements in a lisp routine
to set start up varialbes etc. and all of a sudden they are all failing.... ?

(command "redefine" "fillet")

(command "ambrowser" "off")

Hypersonic


(command "redefine" "fillet")

(command "ambrowser" "off")

These return: invalid AutoCAD command: nil

Hypersonic

O.k. ugh , I have a lisp routine like this:

(defun c:load_library ()
(setq from_load_library T)
  (LOAD "C:/BOB/LSP/LIBRARY")
)

I can type in load_library at the command prompt and all the (command XXXX) commands in the library file work fine....

But if I have a dialog box open (i.e. the newly converted one) and call the (c:load_library) from the button then the above described (command XXXXX  commands no longer work...

So it has something to do with Open dcl, perhaps there is a some setting that is being affected?

Kerry

#49
Firstly,
When asking, provide as much info as possible.

The form is modeless, yes ?

What is the Event Invoke property set to ?  
Should (preferably)  be 1 - Asynchronous

QuoteModeless dialog event handlers are normally invoked in the AutoCAD application context instead of the document context. AutoLISP code running in the application context cannot call document-dependent functions like the (command) function. To deal with this problem, the control's 'Event Invoke' property may be used to trigger the event handler asynchronously in the document context, thus allowing calls to (command) to succeed. Alternatively, the event handler may be executed synchronously, but instead of calling document-dependent functions within the handler function, it can simply trigger a new command to execute in the document context via the (dcl_SendString) function.

It's always a good idea to post code and ODCL.
Sometimes when attempting to build a sample to show the problem the solution will become evident because you have to re-think your code setout.

Have you 'talked to a Teddy Bear'
QuoteOne of the first things I learned as a new programmer was the technique known as "teddy bear programming". A story goes something like this: a university help desk center kept a teddy bear, and before students were allowed to bring their problem to a human, they had to first explain it out loud to a teddy bear. The idea is that by the time they finished telling the bear, over half of them had solved their own problem.
Explaining your problem out loud is often enough to shake things loose in your brain, expose bad assumptions, and cause you to see things in a new way.

... but a rubber duck works well too :)

.. enough levity :
I dont have acadm 2004 to test, but I have ACADM 2007 and 2010 here, so I'll at least be able to say "works for me" or "yes, there's a problem".


PS: I know you've posted parts of the project previously, but I know from my own playing around that sometimes I change a setting or do something that has unexpected ramifications ... having  a current source copy gives anyone reviewing the code a better chance of seeing the problem/solution.
Perfection is not optional.
My other home is TheSwamp

Hypersonic

Thanks Kerry, I checked and it was set to synchronous.... I think this is a new property relative to my old objectDCL code.....
Thank you for the input.... I am also tracking my changes as I saw something about "let me know if there are other required changes " to incorporate in a migration tool..... The migration tool is what finally convinced me to make the swithch... as it looked fairly straightforward.  So maybe it will help others too.

I really appreciate all your help!

Hypersonic

Yep, changed the actual button property to asynchronous and it works!! Thank you!

owenwengerd

The Event Invoke property is not new, but the original ObjectDCL code often ignored it. That may be the case here.
Owen Wengerd (Outside The Box) / ManuSoft

Hypersonic

To the best of my knowledge, I have completed a full conversion of 28 separate applications from ObjectDCL to OpenDCL grand total time invested: about 10-20 hours tops.....

here are some other issues I ran into that others might encounter.... Some are probably already listed in the migration guide, some are due to poor programing on my part.  Just thought I would share.

Overall, it was an easy upgrade!



replace (ObjectDCL_LoadArx)
with (command "_OPENDCL")


;some cases occuring like this.... I think primarily because I was messing with the variable names in old objectDcl

old: (defun c:DBForm1_TextButton1_OnClicked
new: (defun c:debugging_tools_DBForm1_TextButton5_OnClicked (/)

change all files from .odc to .odcl




(dcl_Control_SetRowHeader Untitled_Form1_Grid1 NewValue [as Boolean]) ; old style used 0 or 1 now use nil or T

::::::::::::::::::::::::::::::


(dcl_Grid_AddColumns Layer_Control_LC_Main_Grid1 NewColumns [as List of Lists as ((Caption [as String] {Justification [as Integer]} {ColumnWidth [as Long]} {ColumnImageIndex [as Integer]}) ...)])

Old                              New
(list 1 "Description" 1 200) ==> (list "Description" 1 200)





dcl_control_setenabled functionality has changed.... again boolean instead of 0 or 1



   (dcl_Control_SetValue Shoulder_Punch_Sp_DclForm1_CheckBox1 nil); value needs to be 0 or 1 instead of nil or T


used to be able to use a: dcl_control_setcaption and if the form was not active, it would not error out, now
you need to check to see if the form is active,otherwise it will return an error...


Hypersonic



I just want to thank Owen, Kerry, and Barry for all your incredible help!  You really made the transition easy and fast.
I have been wanting to do it for a couple years now, and now I am up and running.

Also, I would like to make a donation if you could tell me the where and how of it.

Thanks, Bob.

owenwengerd

I've been slowly working on creating a legal entity that can accept donations and manage project development, unfortunately other things keep taking priority. Until I get my act together, just donate your feedback and help make the product better.
Owen Wengerd (Outside The Box) / ManuSoft