Dialog Director

I have a Dialog Director window which has only one editable text field. The
text field is populated with information gathered before the dialog appears.
When the dialog is displayed, the editable text field’s contents are selected.
Is there any way to avoid the selected text?

: I have a Dialog Director window which has only one editable text field. The
: text field is populated with information gathered before the dialog
: appears. When the dialog is displayed, the editable text field’s contents
: are selected. Is there any way to avoid the selected text?
You can add a dummy text field defined before, say, the Ok button with bounds that fit inside those for the button. The dummy field will then be invisible. If it’s defined before the real text field, the text in the real field won’t be selected.

: You can add a dummy text field defined before, say, the Ok button with bounds
: that fit inside those for the button. The dummy field will then be
: invisible. If it’s defined before the real text field, the text in the
: real field won’t be selected.
Yes, I played with this idea a bit before bringing it to the BBS and it
appears to be a valid solution. I just wondered if there was another way. :wink:
The dialog doesn’t have any buttons, so I’ve been experimenting with
other options to hide the dummy text field. Oddly enough, I defined the
bounds of the dummy text field outside of the bounds of the dialog and
it worked! The dummy is completely invisible. I was expecting major
errors but they never came. Strange!
Thanks John!
Rob J

: The dialog doesn’t have any buttons, so I’ve been experimenting with other
: options to hide the dummy text field. Oddly enough, I defined the bounds
: of the dummy text field outside of the bounds of the dialog and it worked!
: The dummy is completely invisible. I was expecting major errors but they
: never came. Strange!
Also worth trying is the Dialog Director item called “dummy”. It’s in it’s dictionary. It’s purpose, I think, is for cases such as this. (This is an untried theory.)
The Dummy item can also be implemented using Dialog Studio…
Dave L.

: Also worth trying is the Dialog Director item called “dummy”. It’s
: in it’s dictionary. It’s purpose, I think, is for cases such as this.
: (This is an untried theory.)
: The Dummy item can also be implemented using Dialog Studio…
: Dave L.
Ahh! I’ve seen the dummy in Dialog Studio but never really knew what its
purpose was. I thought maybe it was a jab at my IQ. :wink:
I’ll give it a try. Thanks!
Rob J

: I have a Dialog Director window which has only one editable text field. The
: text field is populated with information gathered before the dialog
: appears. When the dialog is displayed, the editable text field’s contents
: are selected. Is there any way to avoid the selected text?
You could try…
dd install myDLOG (with greyscale, fonts, whatever)
set d to dd make dialog myDLOG
dd set d’s item 1(the actual item ref number of your text field)'s selection to [integer, integer].
[0,0] will put the insertion point at the start of field;
[-1,-1] will put it at the end.
Regards - Andreas

: You could try…
: dd install myDLOG (with greyscale, fonts, whatever)
: set d to dd make dialog myDLOG
: dd set d’s item 1(the actual item ref number of your text field)'s selection
: to [integer, integer].
: [0,0] will put the insertion point at the start of field;
: [-1,-1] will put it at the end.
: Regards - Andreas
Thanks! I’ll add that to the list of things to try.
Later,
Rob J

Out of curiosity I just tried copying the script from my post and pasting it into my editor. Three extra spaces slightly marred the aesthetics. Please use this version set to “Able
Baker Charlie and other such nonsense”

 set act to { [0, 0], [-1, -1], [5, 10], [34, 42] } 
 set myDLOG to {size:{300, 248}, contents:[ 
 {class:text field, bounds:[10, 10, 290, 208], value:txt},  
 {class:push button, bounds:[248, 218, 288, 238], name:"OK"},  
 b(1, "Start"), b(6, "End"), b(11, "e.g. 1"), b(16, "e.g. 2")]} 

 dd install myDLOG with grayscale 
 set d to dd make dialog myDLOG 
 --dd set d's item 1's selection to [-1, -1] 
 -- That is the key line. Uncomment it to achieve what you asked for; 
 -- the rest is just for fun/demonstration/learningÉ 
 repeat 
 set i to dd interact with user for max ticks 60 
 if i = 2 then exit repeat 
 if i is in {3, 4, 5, 6} then dd set d's item 1's selection to act's item (i - 2) 
 -- That is just to emphasise how it works. 
 end repeat 
 dd uninstall myDLOG 

 on b(h, n) 
 return {class:push button, bounds:[h * 10, 218, h * 10 + 40, 238], name:n} 
 end b

Once I removed some extraneous characters, this worked great! Thank you very much!
Later,
Rob J

: Thanks! I’ll add that to the list of things to try.
Your response to my posting tells me that I was too wishy-washy. Rather than “You could try” I should have said: “Forget about playing around with ‘dummies’; the following is the definitive method of accomplishing what you ask” This is not a guess of mine - it is according to Christopher Hyde’s own documentation.
If you copy the following into your editor all will be revealed.

set act to { [0, 0], [-1, -1], [5, 10], [34, 42] } 
 set myDLOG to {size:{300, 248}, contents:[ 
 {class:text field, bounds:[10, 10, 290, 208], value:txt},  
 {class:push button, bounds:[248, 218, 288, 238], name:"OK"},  
 b(1, "Start"), b(6, "End"), b(11, "e.g. 1"), b(16, "e.g. 2")]} 

 dd install myDLOG with grayscale 
 set d to dd make dialog myDLOG 
 --dd set d's item 1's selection to [-1, -1] 
 -- That is the key line. Uncomment it to achieve what you asked for; 
 -- the rest is just for fun/demonstration/learningÉ 
 repeat 
 set i to dd interact with user for max ticks 60 
 if i = 2 then exit repeat 
 if i is in {3, 4, 5, 6} then dd set d's item 1's selection to act's item (i - 2) 
 -- That is just to emphasise how it works. 
 end repeat 
 dd uninstall myDLOG 

 on b(h, n) 
 return {class:push button, bounds:[h * 10, 218, h * 10 + 40, 238], name:n} 
 end b 

Hope this has been helpful - Andreas.
Evviva dd!

Sorry for taking so long to reply. I don’t even remember the details of the
extraneous characters, other than the fact that there were 3 or 4 of them.
ray@macscripter.net Ray Barber is the admin of this BBS, so he’s probably the one who can best answer your formatting questions.
Later,
Rob J