pman860507 Posted September 1, 2011 Author Posted September 1, 2011 I agree it took me quite a while but i made a lot of modifications that i think improves the command. Mainly i learned a lot. Thanks again for the link i would still be at the beginning without it. Quote
pman860507 Posted September 9, 2011 Author Posted September 9, 2011 Lee i have been looking at. Remembering Dialog Position and have been trying to incorporate it into my code. i have been unsuccessful. i must say I'm completely lost. If anyone has another reference for this or know how its done correctly then please let me know. Thanks. Quote
Lee Mac Posted September 9, 2011 Posted September 9, 2011 i must say I'm completely lost. If anyone has another reference for this or know how its done correctly then please let me know. For a reference, look up the functions: done_dialog, new_dialog in the VLIDE Help Docs. Incorporated into my code from post#32 ([color=BLUE]defun[/color] c:CopyEdit ( [color=BLUE]/[/color] *error* _edit e1 e2 el en id pt ss st ) [color=GREEN];;===============================================;;[/color] [color=GREEN];; Example © Lee Mac 2011 - www.lee-mac.com ;;[/color] [color=GREEN];;===============================================;;[/color] ([color=BLUE]defun[/color] *error* ( msg ) ([color=BLUE]if[/color] ([color=BLUE]<[/color] 0 id) ([color=BLUE]unload_dialog[/color] id)) ([color=BLUE]if[/color] ([color=BLUE]not[/color] ([color=BLUE]wcmatch[/color] ([color=BLUE]strcase[/color] msg) [color=MAROON]"*BREAK,*CANCEL*,*EXIT*"[/color])) ([color=BLUE]princ[/color] ([color=BLUE]strcat[/color] [color=MAROON]"\nError: "[/color] msg)) ) ([color=BLUE]princ[/color]) ) ([color=BLUE]defun[/color] _edit ( dcl value [color=BLUE]/[/color] tmp ) ([color=BLUE]cond[/color] ( ([color=BLUE]new_dialog[/color] [color=MAROON]"copyedit"[/color] dcl [color=MAROON]""[/color] ([color=BLUE]cond[/color] (*screen*) ('(-1 -1)))) ([color=BLUE]set_tile[/color] [color=MAROON]"edit"[/color] ([color=BLUE]setq[/color] tmp value)) ([color=BLUE]action_tile[/color] [color=MAROON]"edit"[/color] [color=MAROON]"(setq tmp $value)"[/color]) ([color=BLUE]action_tile[/color] [color=MAROON]"accept"[/color] [color=MAROON]"(setq *screen* (done_dialog 1))"[/color]) ([color=BLUE]if[/color] ([color=BLUE]=[/color] 1 ([color=BLUE]start_dialog[/color])) ([color=BLUE]setq[/color] value tmp)) ) ) value ) ([color=BLUE]cond[/color] ( ([color=BLUE]<=[/color] ([color=BLUE]setq[/color] id ([color=BLUE]load_dialog[/color] [color=MAROON]"copyedit.dcl"[/color])) 0) ([color=BLUE]princ[/color] [color=MAROON]"\nDCL not Found."[/color]) ) ( ([color=BLUE]not[/color] ([color=BLUE]and[/color] ([color=BLUE]setq[/color] ss ([color=BLUE]ssget[/color] [color=MAROON]"_:L"[/color] '( (-4 . [color=MAROON]"<OR"[/color]) (0 . [color=MAROON]"MTEXT,TEXT"[/color]) (-4 . [color=MAROON]"<AND"[/color]) (0 . [color=MAROON]"INSERT"[/color]) (66 . 1) (-4 . [color=MAROON]"AND>"[/color]) (-4 . [color=MAROON]"OR>"[/color]) ) ) ) ([color=BLUE]setq[/color] pt ([color=BLUE]getpoint[/color] [color=MAROON]"\nBase Point: "[/color])) ) ) ([color=BLUE]princ[/color] [color=MAROON]"\n*Cancel*"[/color]) ) ( [color=BLUE]t[/color] ([color=BLUE]if[/color] ([color=BLUE]setq[/color] e1 ([color=BLUE]entlast[/color]) el e1) ([color=BLUE]while[/color] ([color=BLUE]setq[/color] e2 ([color=BLUE]entnext[/color] el)) ([color=BLUE]setq[/color] el e2)) ([color=BLUE]setq[/color] el [color=BLUE]t[/color]) ) ([color=BLUE]command[/color] [color=MAROON]"_.copy"[/color] ss [color=MAROON]""[/color] [color=MAROON]"_non"[/color] pt [color=BLUE]pause[/color]) ([color=BLUE]if[/color] ([color=BLUE]not[/color] ([color=BLUE]equal[/color] e1 ([color=BLUE]entlast[/color]))) ([color=BLUE]while[/color] ([color=BLUE]setq[/color] el ([color=BLUE]entnext[/color] el)) ([color=BLUE]setq[/color] en ([color=BLUE]entget[/color] el) st ([color=BLUE]assoc[/color] 1 en) ) ([color=BLUE]if[/color] ([color=BLUE]member[/color] ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 0 en)) '([color=MAROON]"ATTRIB"[/color] [color=MAROON]"TEXT"[/color] [color=MAROON]"MTEXT"[/color])) ([color=BLUE]entmod[/color] ([color=BLUE]subst[/color] ([color=BLUE]cons[/color] 1 (_edit id ([color=BLUE]cdr[/color] st))) st en)) ) ) ) ) ) ([color=BLUE]if[/color] ([color=BLUE]<[/color] 0 id) ([color=BLUE]unload_dialog[/color] id)) ([color=BLUE]princ[/color]) ) Quote
pman860507 Posted September 9, 2011 Author Posted September 9, 2011 You showed me my problem. i dont know why but i was thinking that "edit" was my key so i put the screen point with edit instead of "accept". and it works great. Thanks for the links and the help. Quote
Lee Mac Posted September 9, 2011 Posted September 9, 2011 You showed me my problem. i dont know why but i was thinking that "edit" was my key so i put the screen point with edit instead of "accept". 'edit' is still a key, but the key for the edit_box in the dialog - since the screen point is collected from the return of the done_dialog function, this function could potentially be used with any key (but the dialog would close at odd moments!) and it works great.Thanks for the links and the help. Good stuff, I hope you understand why my solution worked and where you were going wrong Quote
pman860507 Posted September 9, 2011 Author Posted September 9, 2011 I do again thanks. this one should be easy for you. Write a program to change all the clocks in the world to 5 pm. Quote
Lee Mac Posted September 9, 2011 Posted September 9, 2011 Write a program to change all the clocks in the world to 5 pm. You got a flux capacitor handy? Quote
BlackBox Posted September 9, 2011 Posted September 9, 2011 I knew it... Lee Mac (the super genius he is), is really the Lawnmower Man!!! ^^ In the movie, after LM uploads his consciousness to the Internets (thank you Al Gore), LM places a call to every phone in the world at the same time. Sorry, it's Friday, and I'm just having a little (albeit unrelated) fun. Hope you don't mind. LoL Quote
BlackBox Posted September 9, 2011 Posted September 9, 2011 You got a flux capacitor handy? Okay, good - Glad I'm not the only one having fun today. Quote
pman860507 Posted September 9, 2011 Author Posted September 9, 2011 You got a flux capacitor handy? I will have to check in my garage to see if i have a spare. Quote
pman860507 Posted September 21, 2011 Author Posted September 21, 2011 So im pretty proud of my self right now. i wanted to add the tag of the object into to the label of the dialog box. which sounds easy for most of you but im still very noob in dcl. also some of our tags are ???? so i had to do some other things to have it say Edit Text of object if the tag had a "?" on it. well the last 3 hours i have been wanting to post on here "zomfg how do i do this!!!" but i decided i would try to figure it out myself. 3 hours later i got it all figure out. I decided to do this because some blocks have 4 or 5 text objects in them. Now for these it says "edit text of DATA" or what ever the tag says unless its "????" This is what i had to add to it. let me know how i did. i had to add to this part. (if (member (cdr (assoc 0 en)) '("ATTRIB" "TEXT" "MTEXT")) (progn (setq title (cdr(Assoc 2 en))) (setq len (strlen title)) (repeat len (setq temp (substr title len 1)) (setq le (cons temp le)) (setq len (- len 1)) ) (if (member "?" le) (setq objt "Edit Text of Object:") (setq objt(strcat "Edit Text of " title ":")) ) (entmod (subst (cons 1 (_edit id (cdr st))) st en)) )) In the _edit i had to add (set_tite "title" objt) then in dcl i added key = "title"; and took out the label Quote
Lee Mac Posted September 21, 2011 Posted September 21, 2011 (edited) Not bad pman Since you asked, here is my suggestion: (if (member (cdr (assoc 0 en)) '("ATTRIB" "TEXT" "MTEXT")) (progn (if (and (eq "ATTRIB" (cdr (assoc 0 en))) (not (wcmatch (cdr (assoc 2 en)) "*`?*")) ) (setq objt (strcat "Edit Content of " (cdr (assoc 2 en)) ":")) (setq objt (strcat "Edit Content of " (strcase (cdr (assoc 0 en)) t) ":")) ) (entmod (subst (cons 1 (_edit id (cdr st))) st en)) ) ) Also, I would pass the dialog title as another argument to the (_edit) function. Edited September 21, 2011 by Lee Mac Quote
pman860507 Posted September 21, 2011 Author Posted September 21, 2011 yeah would work for me an i get this error in visual lisp editor. [CHECKING TEXT loading...] . ; error: bad variable name in SETQ: (STRCASE (CDR ( ... )) T) ; Check done. Which is this line. (setq objt "Edit Content of " (strcase (cdr (assoc 0 en)) t) ":") which i really dont know how it work. (i know what its doing but not how its going about it. should make make it lowercase. "ATTRIB" ...ETC. so here dont you need it to look like this. (setq objt (strcat "Edit Content of " (strcase (cdr (assoc 0 en)) t) ":")) Quote
Lee Mac Posted September 21, 2011 Posted September 21, 2011 so here dont you need it to look like this. (setq objt (strcat "Edit Content of " (strcase (cdr (assoc 0 en)) t) ":")) Oops! Yes - I missed the strcat! Thanks, I'll update my post Quote
pman860507 Posted September 21, 2011 Author Posted September 21, 2011 Wow i did something right. i also changed (cdr (assoc 2 en)) ":")) to (strcase (cdr (assoc 2 en)) t) ":")) just to make sure its lowercase. make it look better. again thanks for all the help. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.