Author Topic: Closing a dialog box that won't close  (Read 12650 times)

0 Members and 1 Guest are viewing this topic.

Arch_Eric

  • Guest
Closing a dialog box that won't close
« on: July 15, 2008, 05:12:42 PM »
I'm working on my first DCL project right now and it involves a main dialog box with global variables for the functions, then buttons on the side for calling the sub dialogs. I've assigned (done_dialog) then a function name to call to load the sub box to each button. (ie (done_dialog)(eu_quoin) ) I load my LISP and call the main function which brings up my nice perty dialog. I click one of the side buttons and the main dialog doesn't disappear, but the sub dialog comes up. I click close on the sub and it closes. But now my main dialog won't close. I click every button (I have a cancel button that calls (done_dialog) and unloads everything) and nothing happens. I have to end the acad.exe task. Any tips? I'll upload my code if I need to.

Arch_Eric

  • Guest
Re: Closing a dialog box that won't close
« Reply #1 on: July 15, 2008, 06:00:37 PM »
Nevermind. I got it working.  :mrgreen:

efernal

  • Bull Frog
  • Posts: 206
Re: Closing a dialog box that won't close
« Reply #2 on: July 17, 2008, 08:44:58 AM »
i'm quite sure you have forget to call (start_dialog)
e.fernal
e.fernal

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Closing a dialog box that won't close
« Reply #3 on: July 17, 2008, 09:16:55 AM »
[rant]

I think it would be great if [you] could post the cause of the problem instead of just saying "Nevermind. I got it working"

[/rant]
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Arch_Eric

  • Guest
Re: Closing a dialog box that won't close
« Reply #4 on: July 17, 2008, 09:39:35 AM »
Well, really it was my lack of knowledge that was the problem. Like I said, I was trying to start another dialog by clicking a button on my first dialog. Before, I was doing this:

Code: [Select]
(defun c:eu ()
 (setq dcl_id (load_dialog "elevutil.dcl"))
  (if (not (new_dialog "eu_main" dcl_id)) (exit))
  (action_tile "cancel" "(done_dialog)")
  (action_tile "fascia" "(done_dialog)(eu_fascia)")
  (action_tile "endcap" "(done_dialog)(eu_endcap)")
  (action_tile "hip" "(done_dialog)(eu_hip)")
  (action_tile "gable" "(done_dialog)(eu_gable)")
  (action_tile "roofline" "(done_dialog)(eu_roofline)")
  (action_tile "quoin" "(done_dialog)(eu_quoin)")
  (start_dialog)
 (unload_dialog dcl_id)
 (princ)
)

All of the eu_ functions that I was calling, except for eu_quoin, didn't require a new dialog because the eu_main dialog has edit boxes for all the global variables for them. My quoin function requires some specific variables. So, eu_quoin starts another dialog box, which is where my problem was. I'm guessing that because I was basically calling start_dialog in an action_tile, the first dialog didn't have a chance to close before the new dialog started, but the done_dialog had been called already so it assumed it was closed. Clear as mud, right? Here was my answer:

Code: [Select]
(defun c:eu ()
 (setq dcl_id (load_dialog "elevutil.dcl"))
 (setq main_flag 1)
 (while (> main_flag 0)
  (if (not (new_dialog "eu_main" dcl_id)) (exit))
  (action_tile "cancel" "(done_dialog 0)")
  (action_tile "fascia" "(done_dialog 1)")
  (action_tile "endcap" "(done_dialog 2)")
  (action_tile "hip" "(done_dialog 3)")
  (action_tile "gable" "(done_dialog 4)")
  (action_tile "roofline" "(done_dialog 5)")
  (action_tile "quoin" "(done_dialog 6)")
  (setq main_flag (start_dialog))
  (cond
   ((= main_flag 1) (eu_fascia))
   ((= main_flag 2) (eu_endcap))
   ((= main_flag 3) (eu_hip))
   ((= main_flag 4) (eu_gable))
   ((= main_flag 5) (eu_roofline))
   ((= main_flag 6) (eu_quoin)))
 )
 (unload_dialog dcl_id)
 (princ)
)

I'm using the return code of done_dialog to determine which function to call long after the dialog is closed. Also the dialog will reopen when the functions are finished. (Thanks to Afralisp for that find) This code is far from being finished, I'm just looking for usability at the moment.

JohnK

  • Administrator
  • Seagull
  • Posts: 10595
Re: Closing a dialog box that won't close
« Reply #5 on: July 17, 2008, 01:17:29 PM »
[rant]

I think it would be great if [you] could post the cause of the problem instead of just saying "Nevermind. I got it working"

[/rant]

*lol*
I know it over but if you would be so kind as to let me know next time...i want in on [this] rant too! Come on coach, put me in, put ME IN!
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Closing a dialog box that won't close
« Reply #6 on: July 17, 2008, 06:19:13 PM »

Thanks Eric,
That will give anyoneo with a similar problem something to find via a search.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Arch_Eric

  • Guest
Re: Closing a dialog box that won't close
« Reply #7 on: July 17, 2008, 09:53:59 PM »
Is that the way ya'll do it?

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Closing a dialog box that won't close
« Reply #8 on: July 31, 2008, 01:22:17 PM »
I know this is kind of late, but when you want to call more than one item in an action_tile, this is how I do it.  Hope that helps, but your way of doing it is fine also.  I have some code that does it the same way.

Code: [Select]
(action_tile "TextRad"
    "(progn
        (mode_tile \"HeadRadCol\" 1)
        (mode_tile \"TitleRadCol\" 1)
        (mode_tile \"GridRadCol\" 0)
        (setq TableAli
            (car (nth (atoi (get_tile \"AliPul\")) TableAliList))
        )
        (start_list \"AliPul\" 3)
        (foreach lst TextAliList
            (add_list (car lst))
        )
        (end_list)
        (set_tile \"AliPul\"
            (itoa
                (vl-position (assoc TextAli TextAliList) TextAliList)
            )
        )
    )"
)

Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.