ArborX


wdb

Longname: w indow d ialogue b ox   Open the Documentation Legend
Released: not available 
Created: not available 
Last modified: 6.52a 
See also: getvar wdbm twdbm

Summary
Invokes a dialogue box, either to screen or to a set of named variables which can be used and manipulated in a script or further macro. Both forms of wdb are used extensively within scripts.
Example extract

The macros shown below as they would appear in a script make an 'invisible' call to Arbortext APP's typeface name dialogue box:

 wdb "variable1","variable2","variable3" 3
 tf 5

Usually, when you enter the macro on its own the typeface name dialogue box would appear. This shows the 'short' and 'long' names of the currently-selected typeface, in two edit boxes one above the other. When you enter the tf macro immediately after a valid wdb macro, the dialogue box will not appear and the contents of each edit box are 'pushed' into the variables named by wdb in the order they appear in the dialogue box. In this example ^variable1 would receive the font short name, and ^variable2 would receive the font long name. The wdb macro asks for three variables to be filled: but because the typeface name dialogue box only contains two edit boxes, ^variable3 remains unaffected, i.e. retains any value it previously had.


Syntax (SVNNA)
Ø:n

When used without parameters wdb can be used to switch off 'invisible' dialogue box trapping. This is useful for trapping error condition, for example, the macro shown below can be used to delete a tag without generating an error message if the tag does not exist.

 wdb "_z_":ttagdel "anytag":wdb
string:n

The number of a string defining a dialogue box. The text for the dialogue box is taken from the given string number defined in the stuk.3ad system file, in a user strings file, or by a script.

Example

The example below shows a simple use of the ^wdb variable, along with ? macros, in a stripped down version of the script used in stuk.3ad to define the search/replace dialogue box.

 "ts", "320" 1
 $defstr 349,"@/ @|Search / Replace\n"<> 2
 $addstr 349,"--\n"<> 3
 $addstr 349,"Search for:\n"<> 4
 $addstr 349," ^_sr_s_str%1..40sn!?7,@\\\\%d\\\\!\n"<> 5
 $addstr 349,"Replace with (blank for Search only):\n"<> 6
 $addstr 349," ^_sr_r_str%0..40sn!?7,@\\\\%d\\\\!\n"<> 7
 $addstr 349,"Options: ^_sr_o_str%0..20snx!348!\n"<> 8
 $addstr 349,"--\n"<> 9
 $addstr 349,"|Keep above settings: ^_sr_k_keep%0..1B[Yes] [No]\n"<> 10
 $addstr 349,"--\n"<> 11
 $addstr 349,"|%2..1e [OK] [Cancel]"<> 12
 $defstr 348,"Search/Replace Options:\n"<> 13
 $addstr 348," t -- start from Top|@t\n"<> 14
 . . . . 15
 $addstr 348," num repeat num times\n"<> 16
 #if REGEXPS 17
 $addstr 348,"Standard search:\n"<> 18
 #endif 19
 $addstr 348," ? -- wildcard ? on|@?\n"<> 20
 $addstr 348," [ -- search/insert|@[\n"<> 21
 $addstr 348," ] -- search/append|@]\n"<> 22
 #if REGEXPS 23
 $addstr 348,"Regular expressions:\n"<> 24
 $addstr 348," r -- normal|@r\n"<> 25
 $addstr 348," x -- eXtended . matching|@x\n"<> 26
 #endif 27
 $wdb 349<> 28
 $^wdb----<> 29
 $?0^wdb trun 0<> 30
 $^blank=<> 31
 $?=^_sr_r_str,^blank /^_sr_s_str/^_sr_o_str^<> 32
 $?+^_sr_r_str,^blank /^_sr_s_str/^_sr_r_str/^_sr_o_str^<> 33

flags:s

Instructs the dialogue box to conform to the following options.

Centre dialogue box on mouse.
Help dialogue box format.
No title for dialogue box.
No background for dialogue box (yellow bar).
16  X & Y centre pos passed in "str" (top left if flags 8).
32  Parameters passed in an array.
64  Called from wdb (so no args on stack).
script variable:s

One or more variable names separated by a comma or space character. These variables will be filled by the subsequent call to a dialogue box using macro, and are filled in in the order that the dialogue box fields are defined. If you do not want to collect information from a specific field this can be skipped over by using a dummy script variable, e.g. "".

Scripts using the wdb macro in this way are sensitive to the order in which edit boxes appear in a 3B2 dialogue box. Advent reserves the right to alter this order during the development of 3B2.

exit code:n

Returns an exit code to an 'invisible' dialogue box. This is useful when a script invokes an 'are you sure' type of dialogue box, which requires an OK response. It can also be used to access some otherwise elusive dialogue boxes.

Example

With a frame selected, the macro shown below will invoke the Unequal Columns dialogue box. Without the final wdb, and with more script variable entries, this would give a script access to the column settings for a frame.

  1
 wdb "_z_",3:tfcol:wdb 2

When used with a script variable wdb affects the next dialogue box that appears. The macro used to invoke the dialogue box whose values are to be passed to one or more script variable items. The dialogue box will not be drawn on screen, but its contents will be passed in order to the script variables.

Macros and scripts can communicate with 3B2 in many ways, allowing you to extract information about the user's setup or the state of the current document. The simplest way of communicating with 3B2 is to make an 'invisible' call to one of 3B2's existing dialogue boxes using the wdb macro. Any of the information that you would usually see in a dialogue box can be 'pushed' into a variable of your choice.

Example

One of the most useful features of the tgm macro is that it can be combined with wdb to extract information about a selected graphic shape. The macro shown below gets the size of the selected shape:

 wdb "Height" "Width" 3
 tgm:tgssize 5

Document created on 08-Feb-2003 (revision 1)