grifflicious Posted February 9 Posted February 9 (edited) Hey gang! I'm having a ton of trouble getting this lisp function to work correctly. I had no issues with the input field boxes but the popup list is driving me insane at this point. I've built a list and tried getting the list to load into the function but I can't seem to get it to work. Does anyone have a good handle on this sort of thing or perhaps even have a direction to point me in in order to find a solution? Below is the code so you can see where I'm at with it. Thank you in advance! (defun CG:legal-dialog() (if LEGAL-EP (progn (setq dcl (strcat (getenv "TMP") "\\legal_dialog.dcl")) (setq des (open dcl "w")) (if (not des) (progn (alert "Error: Unable to create the dialog file.")) (progn (setq COUNTY "XXX") (setq countylistTX '( "Anderson" "Andrews" "Angelina" "Aransas" "Archer" "Armstrong" "Atascosa" "Austin" "Bailey" "Bandera" "Bastrop" "Baylor" "Bee" "Bell" "Bexar" "Blanco" "Borden" "Bosque" "Bowie" "Brazoria" "Brazos" "Brewster" "Briscoe" "Brooks" "Brown" "Burleson" "Burnet" "Caldwell" "Calhoun" "Callahan" "Cameron" "Camp" "Carson" "Cass" "Castro" "Chambers" "Cherokee" "Childress" "Clay" "Cochran" "Coke" "Coleman" "Collin" "Collingsworth" "Colorado" "Comal" "Comanche" "Concho" "Cooke" "Coryell" "Cottle" "Crane" "Crockett" "Crosby" "Culberson" "Dallam" "Dallas" "Dawson" "Deaf Smith" "Delta" "Denton" "DeWitt" "Dickens" "Dimmit" "Donley" "Duval" "Eastland" "Ector" "Edwards" "Ellis" "El Paso" "Erath" "Falls" "Fannin" "Fayette" "Fisher" "Floyd" "Foard" "Fort Bend" "Franklin" "Freestone" "Frio" "Gaines" "Galveston" "Garza" "Gillespie" "Glasscock" "Goliad" "Gonzales" "Gray" "Grayson" "Gregg" "Grimes" "Guadalupe" "Hale" "Hall" "Hamilton" "Hansford" "Hardeman" "Hardin" "Harris" "Harrison" "Hartley" "Haskell" "Hays" "Hemphill" "Henderson" "Hidalgo" "Hill" "Hockley" "Hood" "Hopkins" "Houston" "Howard" "Hudspeth" "Hunt" "Hutchinson" "Irion" "Jack" "Jackson" "Jasper" "Jeff Davis" "Jefferson" "Jim Hogg" "Jim Wells" "Johnson" "Jones" "Karnes" "Kaufman" "Kendall" "Kenedy" "Kent" "Kerr" "Kimble" "King" "Kinney" "Kleberg" "Knox" "La Salle" "Lamar" "Lamb" "Lampasas" "Lavaca" "Lee" "Leon" "Liberty" "Limestone" "Lipscomb" "Live Oak" "Llano" "Loving" "Lubbock" "Lynn" "Madison" "Marion" "Martin" "Mason" "Matagorda" "Maverick" "McCulloch" "McLennan" "McMullen" "Medina" "Menard" "Midland" "Milam" "Mills" "Mitchell" "Montague" "Montgomery" "Moore" "Morris" "Motley" "Nacogdoches" "Navarro" "Newton" "Nolan" "Nueces" "Ochiltree" "Oldham" "Orange" "Palo Pinto" "Panola" "Parker" "Parmer" "Pecos" "Polk" "Potter" "Presidio" "Rains" "Randall" "Reagan" "Real" "Red River" "Reeves" "Refugio" "Roberts" "Robertson" "Rockwall" "Runnels" "Rusk" "Sabine" "San Augustine" "San Jacinto" "San Patricio" "San Saba" "Schleicher" "Scurry" "Shackelford" "Shelby" "Sherman" "Smith" "Somervell" "Starr" "Stephens" "Sterling" "Stonewall" "Sutton" "Swisher" "Tarrant" "Taylor" "Terrell" "Terry" "Throckmorton" "Titus" "Tom Green" "Travis" "Trinity" "Tyler" "Upshur" "Upton" "Uvalde" "Val Verde" "Van Zandt" "Victoria" "Walker" "Waller" "Ward" "Washington" "Webb" "Wharton" "Wheeler" "Wichita" "Wilbarger" "Willacy" "Williamson" "Wilson" "Winkler" "Wise" "Wood" "Yoakum" "Young" "Zapata" "Zavala")) (start_list "county" 3) (mapcar 'add_list countylistTX) (end_list) (foreach x '( " info : dialog"; "{" " label = \"Ownership/Recording Info\";" " key = \"dcl\";" " spacer;" " : column " " {" " : boxed_row" " : boxed_column" " {" " spacer;" " : popup_list" " {" " key = \"county\";" " label = \"&County:\";" " width = 30;" " value = \"1\";" " action = \"(setq COUNTY (strcat (get_tile \\\"county\\\")))\";" " }" " }" " : edit_box" " {" " key = \"survey\";" " label = \"Survey:\";" " edit_width = 15;" " value = \"\";" " action = \"(setq SURVEY (get_tile \\\"survey\\\"))\";" " }" " spacer;" " : edit_box" " {" " key = \"abstract\";" " label = \"Abstract:\";" " edit_width = 15;" " value = \"\";" " action = \"(setq ABSTRACT (get_tile \\\"abstract\\\"))\";" " }" " spacer;" " : edit_box" " {" " key = \"ownership\";" " label = \"Ownership:\";" " edit_width = 15;" " value = \"\";" " action = \"(setq OWNERSHIP (get_tile \\\"ownership\\\"))\";" " }" " spacer;" " : edit_box" " {" " key = \"acerage\";" " label = \"Acerage:\";" " edit_width = 15;" " value = \"\";" " action = \"(setq ACERAGE (get_tile \\\"acerage\\\"))\";" " }" " spacer;" " : edit_box" " {" " key = \"recording\";" " label = \"Recorded In:\";" " edit_width = 15;" " value = \"\";" " action = \"(setq RECORDING (get_tile \\\"recording\\\"))\";" " }" " spacer;" " : boxed_row" " {" " : button " " {" " key = \"accept\";" " label = \"Okay or Use Previous\";" " is_default = true;" " }" " spacer;" " : button " " {" " key = \"cancel\";" " label = \"Cancel\";" " is_default = false;" " is_cancel = true;" " }" " }" " }" " }" ) (write-line x des) ) (setq des (close des)) (setq dch (load_dialog dcl)) (if (= dch nil) (progn (alert "Error: Unable to load the dialog.")) (progn (new_dialog "info" dch) (setq result (start_dialog)) (unload_dialog dch))) ) ) ) ) ) Edited February 9 by SLW210 Added Code Tags! Quote
grifflicious Posted February 9 Author Posted February 9 14 minutes ago, SLW210 said: Please use Code Tags. (<> in the editor toolbar) Apologies, this is my first post and I wasn't aware that was a thing. Quote
pkenewell Posted February 9 Posted February 9 (edited) 2 hours ago, grifflicious said: Does anyone have a good handle on this sort of thing or perhaps even have a direction to point me in in order to find a solution? Below is the code so you can see where I'm at with it. Thank you in advance! @grifflicious It looks to me like your trying to load the DCL file and dialog box before it is written. The DCL has to exist before you can load it. Try this - I tested it and it works: (defun CG:legal-dialog() (if LEGAL-EP (progn (if (not (findfile (setq dcl (strcat (getenv "TMP") "\\legal_dialog.dcl")))) (progn (setq des (open dcl "w")) (foreach x '( " info : dialog"; "{" " label = \"Ownership/Recording Info\";" " key = \"dcl\";" " spacer;" " : column " " {" " : boxed_row" " : boxed_column" " {" " spacer;" " : popup_list" " {" " key = \"county\";" " label = \"&County:\";" " width = 30;" " value = \"1\";" " action = \"(setq COUNTY (strcat (get_tile \\\"county\\\")))\";" " }" " }" " : edit_box" " {" " key = \"survey\";" " label = \"Survey:\";" " edit_width = 15;" " value = \"\";" " action = \"(setq SURVEY (get_tile \\\"survey\\\"))\";" " }" " spacer;" " : edit_box" " {" " key = \"abstract\";" " label = \"Abstract:\";" " edit_width = 15;" " value = \"\";" " action = \"(setq ABSTRACT (get_tile \\\"abstract\\\"))\";" " }" " spacer;" " : edit_box" " {" " key = \"ownership\";" " label = \"Ownership:\";" " edit_width = 15;" " value = \"\";" " action = \"(setq OWNERSHIP (get_tile \\\"ownership\\\"))\";" " }" " spacer;" " : edit_box" " {" " key = \"acerage\";" " label = \"Acerage:\";" " edit_width = 15;" " value = \"\";" " action = \"(setq ACERAGE (get_tile \\\"acerage\\\"))\";" " }" " spacer;" " : edit_box" " {" " key = \"recording\";" " label = \"Recorded In:\";" " edit_width = 15;" " value = \"\";" " action = \"(setq RECORDING (get_tile \\\"recording\\\"))\";" " }" " spacer;" " : boxed_row" " {" " : button " " {" " key = \"accept\";" " label = \"Okay or Use Previous\";" " is_default = true;" " }" " spacer;" " : button " " {" " key = \"cancel\";" " label = \"Cancel\";" " is_default = false;" " is_cancel = true;" " }" " }" " }" " }" ) (write-line x des) ) (close des) ) ) (setq id (load_dialog dcl)) (new_dialog "info" id) (setq COUNTY "XXX") (setq countylistTX '( "Anderson" "Andrews" "Angelina" "Aransas" "Archer" "Armstrong" "Atascosa" "Austin" "Bailey" "Bandera" "Bastrop" "Baylor" "Bee" "Bell" "Bexar" "Blanco" "Borden" "Bosque" "Bowie" "Brazoria" "Brazos" "Brewster" "Briscoe" "Brooks" "Brown" "Burleson" "Burnet" "Caldwell" "Calhoun" "Callahan" "Cameron" "Camp" "Carson" "Cass" "Castro" "Chambers" "Cherokee" "Childress" "Clay" "Cochran" "Coke" "Coleman" "Collin" "Collingsworth" "Colorado" "Comal" "Comanche" "Concho" "Cooke" "Coryell" "Cottle" "Crane" "Crockett" "Crosby" "Culberson" "Dallam" "Dallas" "Dawson" "Deaf Smith" "Delta" "Denton" "DeWitt" "Dickens" "Dimmit" "Donley" "Duval" "Eastland" "Ector" "Edwards" "Ellis" "El Paso" "Erath" "Falls" "Fannin" "Fayette" "Fisher" "Floyd" "Foard" "Fort Bend" "Franklin" "Freestone" "Frio" "Gaines" "Galveston" "Garza" "Gillespie" "Glasscock" "Goliad" "Gonzales" "Gray" "Grayson" "Gregg" "Grimes" "Guadalupe" "Hale" "Hall" "Hamilton" "Hansford" "Hardeman" "Hardin" "Harris" "Harrison" "Hartley" "Haskell" "Hays" "Hemphill" "Henderson" "Hidalgo" "Hill" "Hockley" "Hood" "Hopkins" "Houston" "Howard" "Hudspeth" "Hunt" "Hutchinson" "Irion" "Jack" "Jackson" "Jasper" "Jeff Davis" "Jefferson" "Jim Hogg" "Jim Wells" "Johnson" "Jones" "Karnes" "Kaufman" "Kendall" "Kenedy" "Kent" "Kerr" "Kimble" "King" "Kinney" "Kleberg" "Knox" "La Salle" "Lamar" "Lamb" "Lampasas" "Lavaca" "Lee" "Leon" "Liberty" "Limestone" "Lipscomb" "Live Oak" "Llano" "Loving" "Lubbock" "Lynn" "Madison" "Marion" "Martin" "Mason" "Matagorda" "Maverick" "McCulloch" "McLennan" "McMullen" "Medina" "Menard" "Midland" "Milam" "Mills" "Mitchell" "Montague" "Montgomery" "Moore" "Morris" "Motley" "Nacogdoches" "Navarro" "Newton" "Nolan" "Nueces" "Ochiltree" "Oldham" "Orange" "Palo Pinto" "Panola" "Parker" "Parmer" "Pecos" "Polk" "Potter" "Presidio" "Rains" "Randall" "Reagan" "Real" "Red River" "Reeves" "Refugio" "Roberts" "Robertson" "Rockwall" "Runnels" "Rusk" "Sabine" "San Augustine" "San Jacinto" "San Patricio" "San Saba" "Schleicher" "Scurry" "Shackelford" "Shelby" "Sherman" "Smith" "Somervell" "Starr" "Stephens" "Sterling" "Stonewall" "Sutton" "Swisher" "Tarrant" "Taylor" "Terrell" "Terry" "Throckmorton" "Titus" "Tom Green" "Travis" "Trinity" "Tyler" "Upshur" "Upton" "Uvalde" "Val Verde" "Van Zandt" "Victoria" "Walker" "Waller" "Ward" "Washington" "Webb" "Wharton" "Wheeler" "Wichita" "Wilbarger" "Willacy" "Williamson" "Wilson" "Winkler" "Wise" "Wood" "Yoakum" "Young" "Zapata" "Zavala")) (start_list "county" 3) (mapcar 'add_list countylistTX) (end_list) (setq result (start_dialog)) (unload_dialog id) ) ) ) Edited February 9 by pkenewell 1 Quote
grifflicious Posted February 9 Author Posted February 9 I tried what you wrote and perhaps I'm doing something else wrong that I'm not aware of but when I run that function, I get "Cannot find definition for dialog info" 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.