"next/back" button

Started by Derfell, March 16, 2011, 03:39:23 AM

Previous topic - Next topic

Derfell

Good morning, i'm new with Autolisp and DCL so probably this is a stupid question but i hope you can help me. How can I realize the next and back buttons to go from one dialog to the other?
thanks

krunch

Hi
I think you should clarify :
- what do you call "dialog" ? Is it a (displayed) Form ?
- what do you call "go from to" ? Give focus or display ?

Derfell

Hi, i'm sorry for my bad English.
I try to clarify:
I've 2 Modal Dialogs: "a" and "b". I need to put in "a" the "next" button  to close "a" and display "b". Then i have to put in "b" the "back" button to close "b" and display "a"

krunch

This is something like that (try the sample below)

But the last dcl_Form_Show doesn't work, I don't know why (I probably miss something)
May be someone will complete...

Code (autolisp) Select
(defun c:go ()
  (command "OPENDCL")
  (dcl_Project_Load "ToggleForm" T)
  (dcl_Form_Show ToggleForm_Form1)
  (princ)
)
(defun c:ToggleForm_Form1_TextButton1_OnClicked (/)
  (dcl_Form_Close ToggleForm_Form1)
  (dcl_Form_Show ToggleForm_Form2)
)
(defun c:ToggleForm_Form2_TextButton1_OnClicked (/)
  (dcl_Form_Close ToggleForm_Form2)
  (dcl_Form_Show ToggleForm_Form1) ; doesn't work :-(
)

krunch

#4
Effectively I missed something, this version works...

Code (autolisp) Select
(defun c:go (/ tmp)
  (command "OPENDCL")
  (dcl_Project_Load "ToggleForm" T)
 
  (setq tmp 1)
  (while (> tmp 0)
    (setq tmp (dcl_Form_Show "ToggleForm" (if (= tmp 1) "Form1" "Form2")))
  )
  (princ)
)
(defun c:ToggleForm_Form1_TextButton1_OnClicked (/)
  (dcl_Form_Close ToggleForm_Form1 2)
)
(defun c:ToggleForm_Form2_TextButton1_OnClicked (/)
  (dcl_Form_Close ToggleForm_Form2 1)
)
(defun c:ToggleForm_Form1_OnCancelClose (Reason /)
  (dcl_Form_Close ToggleForm_Form1 0)
)
(defun c:ToggleForm_Form2_OnCancelClose (Reason /)
  (dcl_Form_Close ToggleForm_Form2 0)
)

Derfell

Thanks for your help, you're very kind. It works perfectly!