|
|
|
Field Entry Dialog Box
Added on 8/1/1999
|
This is a basic field entry dialog box that uses the MUI Xtra.
--Copyright 1999 Chuck Neal
--chuck@mediamacros.com
--If you find this code helpful, send me an e-mail and let me know. :-)
global box, valueList
on createDialog whatTitle, whatPrompt, defaultText , handler
box = new(xtra "MUI")
valueList = [#nameField : defaultText]
boxProp = getWindowPropList(box)
boxProp[#name] = whatTitle
boxProp[#callback] = "boxcallback"
boxProp[#xPosition] = -1
boxProp[#yPosition] = -1
boxProp[#width] = 0
boxProp[#height] = 0
boxProp[#mode] = #data
--define the elements
windowStart = [#value : 0, #type : #windowBegin, #attributes : [], #title : "", #tip : "", #width: 0, #height: 0, #enabled: 1]
groupHValStart = [#value : 0, #type : #groupHBegin, #attributes : [#centerH], #title : "", #tip : "", #width: 0, #height: 0, #enabled: 1]
groupHValEnd = [#value : 0, #type : #groupHEnd, #attributes : [], #title : "", #tip : "", #width: 0, #height: 0, #enabled: 1]
nameLabel = [#value: WhatPrompt, #type: #label, #attributes: [], #title: "Input", #tip: "", #width: 0, #height: 0, #enabled: 1]
nameField = [#value : valueList[#nameField], #type : #editText, #attributes : [], #title: "NameField", #tip: "tip", #locH: 20, #locV: 24, #width: 200, #height: 210, #enabled: 1]
okButton = [#type : #pushButton, #attributes : [], #title : "OK", #tip : "OK", #width : 60, #height : 0, #enabled : true]
cancelButton = [#type : #pushButton, #attributes : [], #title : "Cancel", #tip : "Cancel", #width : 0, #height : 0, #enabled : true]
windowEnd = [#value : 0, #type : #windowEnd, #attributes : [], #title : "", #tip : "", #width: 0, #height: 0, #enabled: 1]
--create the box"s paramater list
contentList = [windowStart, nameLabel, nameField, groupHValStart, okButton, cancelButton, grouphValEnd, windowEnd]
--set a global list ofthe changeable paramaters
valueList = [#nameField : ""]
--initialize the box
Initialize(box, [#windowPropList:boxProp, ¬
#windowItemList:contentList])
--run the box
test = run(box)
do(handler & "(valueList)")
end
on boxCallback event, eventData, itemPropList, thisPropList
case event of
#itemChanged :
case itemPropList[#title] of
"NameField" :
valueList[#nameField] = itemPropList[#value]
end case
#itemClicked :
case itemPropList[#title] of
"OK" :
stop(box, 1)
return valueList
"Cancel" :
stop(box, 0)
end case
end case
end
on getBehaviorDescription me
return "This script accepts input for the boxes title(whatTitle), the question or prompt on the box(whatPrompt), the default string for the answer(defaultText) , and the name of a handler to use with the returned list(handler). The first 3 are any string you want to use. For the handler, put the name of the handler without the (), or -- for no handler."
end
|
|