Jump to content

DCL Selection Always Acts the Same


Recommended Posts

Posted

I know I have many bad habits. But I must be doing something wrong with my DCL and it's finally bitten me. Here's a short DCL I thought I would be done with last Monday.

 

 
ANYGAP : dialog {
label = "2D Electrical Drafting";
: column {
 : edit_box { key = "thisvalue"; label = "Insert Text"; width = 20; }
 : toggle { key = "interval"; label = "Use Regular Interval"; fixed_width = true; }    
 : edit_box { key = "distance"; label = "Interval Distance"; fixed_width = true; }    
 : button { key = "distancepick"; label = "By Pick <"; fixed_width = true; }

 : row {
   : button { key = "pickline"; label = "Pick LWPolyLine"; fixed_width = true; }      
   : button { key = "cancel"; label = " Cancel "; is_default = false; is_cancel = true; fixed_width = true; }
   }
 }
}  

 

Here's the lsp code:

 

 
(DEFUN C:ANYGAP ( )
 (IF (NOT DCLPOSANYGAP) (SETQ DCLPOSANYGAP '(600 700)))
 (IF (NOT ANYGAPT) (SETQ ANYGAPT ""))
 (IF (NOT ANYGAPD) (SETQ ANYGAPD 0))
 (IF (NOT AGUSEINTERVAL) (SETQ AGUSEINTERVAL -1))
 (VL-LOAD-COM)
 (SETQ DCLID (LOAD_DIALOG "E:\\lisps\\anygap.dcl"))
 (IF (NOT (NEW_DIALOG "ANYGAP" DCLID "" DCLPOSANYGAP)) (EXIT))
 (SET_TILE "thisvalue" ANYGAPT)
 (SET_TILE "distance" (RTOS ANYGAPD 5 2))
 (ACTION_TILE "thisvalue" "(SETQ SELECTION $value TV T DCLPOSANYGAP (DONE_DIALOG))")
 (ACTION_TILE "interval" "(SETQ SELECTION $key DCLPOSANYGAP (DONE_DIALOG))")
 (ACTION_TILE "distance" "(SETQ SELECTION $value DV T DCLPOSANYGAP (DONE_DIALOG))")
 (ACTION_TILE "distancepick" "(SETQ SELECTION $key DCLPOSANYGAP (DONE_DIALOG))")
 (ACTION_TILE "pickline" "(SETQ SELECTION $key DCLPOSANYGAP (DONE_DIALOG))")
 (ACTION_TILE "cancel" "(SETQ SELECTION $key DCLPOSANYGAP (DONE_DIALOG))")
 (SETQ RETURN (START_DIALOG))
 (PRINC)
 );DEFUN

 

The problem is that no matter what I select or do in the box, the lisp code responds like the "thisvalue" keyed edit_box is what was selected. There must be a typo or improperly correlated items that I think match up and my poor methodology doesn't allow me to see it. Please help me spot it, and how do you do things so that the problem is more obvious? Thanks in advance for your time.

Posted

You have a done_dialog call in the action_tile expression for every tile in the dialog, meaning that the dialog will close the moment the user alters a tile.

Posted

Progress, but now a new problem. The above was an excerpt from my whole program. The habit I have is to done_dialog after every selection, do some work on the selection (ranging from storing a variable to a few calculations and manipulating an object on the screen) and then going back to the box. The box controls are contained in a while loop. I think that's called hiding the box.? So I understood what you said, Lee, didn't know where it would take me but I undertook a re-write. I'm certainly not going to argue with you. Funny thing was, I ended up keeping the loop anyway, substantially unchanged. Out of such a small 6 element box, 2 needed to hide it and 2 were basically an OK/Cancel. (1) required user screen input and (1) enabled/disabled other elements.

 

So anyway, here's what I found. The first element in the DCL was an edit_box. Nothing was flagged by me as a default. So what I wasn't noticing was that when the box was put up, the edit_box was active with a cursor blinking in it awaiting input. So when I first selected another element, the first thing it did was close the edit, returning the edit_box programming, seemingly ignoring what I had tried to select. Hence the title of my thread, 'DCL selection always acts the same.' So I made the 'OK' button the default, in the DCL (a 3 second edit, I might add). Now nothing is really active and its just sitting there waiting for input. But now I have new problem.

 

So I'm essentially back to my starting point of hiding the box in while loop, my standard 'habit'. The weird thing was, the second time through the loop it was ignoring the start_dialog and wouldn't put the box back up. I couldn't understand that. But it was also 1:00 am, so I just went to bed. Maybe sleep will help it. One question that came up while I briefly reviewed proper hiding methods, was the unload_dialog. I never unload my dialogs. Is that important? What does it do for me, I've never noticed any consequence?

 

So that's probably too much information. Start_dialog wont put my box back up. Any thoughts on that? Thanks in advance.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...