news
About Elegant Chaos
info
About me and my friends
people
Software from Elegant Chaos
software
Other stuff...
stuff

Modal

An XCMD allowing you to create and display a modal dialog. Unlike the Dialog command, each text item can have its own style and font.

Modal XCMD. Version 1.1d1, by Sam Deane. Copyright ©1994 ULTRALAB. Compiled 16:50:58, 28/04/94.


[last exit to hypercard] [externals index] [download Modal]

Description

This XCMD creates and displays a modal dialog.

Unlike the Dialog XCMD, the Modal command creates the dialog on the fly, from parameters that you pass it describing all the dialog items.

The dialog items can each have a different font/style, which makes the command more flexible than the Ask and Answer commands, and allows it to deal with situations where the Dialog XCMD couldn't cope either.

Currently this command allows you to display editable text, but doesn't return it so that you can find out what was entered! This will be fixed in a later release! However, the command is still useful as it is, for displaying multi-font (perhaps multi-lingual) dialogs.


Commands

create

This command creates a modal dialog.

The basic syntax is:

  Modal "create",<item>,<item>,....,<item>

Each <item> parameter describes one item in the dialog. The format of the parameters vary depending on the kind of item being described, but the basic format is:

  "<type> / <rect> / <status> / <other parameters>"

The <type> parameter can be one of: text, edit, button, or picture.

The <rect> parameter describes the position and size of the item, relative to the top left hand corner of the dialog.

The <status> parameter says whether the item is inactive (ie can't be clicked on), active, or is the default or cancel item. The default item is outlined with a thick border, and it chosen by default if the return or enter key is pressed. The cancel item is chosen by default if the escape key is pressed. The <status> parameter should be one of: active,inactive,default,cancel.

The other parameters vary depending upon the item type:

PICTURE ITEMS

The full syntax for a picture item is:

  "<type> / <rect> / <status> / <name>"

The <name> parameter gives the name of the PICT resource to display.

OTHER ITEMS

The full syntax for a button, text or editable text item is:

  "<type>/<rect>/<status>/<source>/<font>/<size>/<contents>"

The <source> parameter tells the XCMD where the text for the item should be taken from. It should be one of: resource,string,global,card, or background.

The <font> and <size> parameters specify the default font and size for the item.

The meaning of the <contents>parameter depends upon the value of the <source> parameter.

If the <source> parameter was card, or background, then the <contents> parameter gives the name of a card or background field containing the contents of the item.

If the <source> parameter was string, the <contents> parameter contains the contents of the item.

If the <source> parameter was global, the <contents> parameter contains the name of a global variable containing the item's contents.

If the <source> parameter was resource, the <contents> parameter contains the name of a TEXT/styl resource pair, containing the contents of the item.

Example script for create

on mouseUp
  put "picture/13,13,45,45/inactive/test/" into picture
  put "edit/53,13,309,45/active/resource/another test" into text
  put "button/245,53,309,73/default/string/geneva/9/this is a bit too long OK" into ok
  Modal create,picture,text,ok
  answer the result
end mouseUp

[last exit to hypercard] [externals index] [download Modal]

This page was created automatically, on 25/03/1999 from version 3.0d4 of Last Exit To Hypercard.