Looking for help with a survey app for Amiwest
Posted: Fri Oct 21, 2011 4:34 am
Hi All,
Looking for some help with building an app for Amiwest to collect survey data for the folks who are attending. I've got hollywood 4.8 and found SCUI. I've put together a quick app which can collect the data but I'm stuck figuring out how to get my "save" button to write the details to a file and clear the existing fields. Hoping someone can look at my code and get me started:
Thank you!
tekmage
Looking for some help with building an app for Amiwest to collect survey data for the folks who are attending. I've got hollywood 4.8 and found SCUI. I've put together a quick app which can collect the data but I'm stuck figuring out how to get my "save" button to write the details to a file and clear the existing fields. Hoping someone can look at my code and get me started:
Code: Select all
; SCUI SHOWCASE
; -----------------------------------------------------------------------------
@INCLUDE "ScuiLib.hws"
; -----------------------------------------------------------------------------
ChangeDisplaySize(610, 550)
MoveDisplay(#CENTER, #CENTER)
scui.prefs.DebugMode = False
Function ButtonID(mess)
DebugPrint("---------------------> EVENT HANDLER TEST:", mess.id, mess.event)
EndFunction
;=== TEST ZONE ===
DebugPrint("Building the interface...")
; BACKGROUND FRAME
scui.NewObject( #IFOCLASS_BEVELBOX, "BGFrame", ; Gadget Class
{ x = 5, y = 5 }, ; Position
{ x = 600, y = 540 } ) ; Size
; Title
scui.NewObject( #IFOCLASS_LABEL, "Title",
{ x = 10, y = 10 },
{ x = 590, y = 40 },
{ Bevel = { Colors = { Fill1 = { r=255, g=255, b=160} } },
Text = { FontName = "Diamond.font",
FontSize = 20,
Alignment = #TEXTALIGN_HCENTER } },
{ Values = { "Amiwest Sign up App" }, Lines = 1 } )
;First name
scui.NewObject( #IFOCLASS_LABEL, "Lable_firstname",
{ x = 10, y = 55 },
{ x = 90, y = 20 },
{ Bevel = { Colors = { Fill1 = { r=255, g=255, b=160} } },
Text = { FontName = "Diamond.font",
FontSize = 12,
Alignment = #TEXTALIGN_HCENTER } },
{ Values = { "First Name" }, Lines = 1 } )
firstname = scui.NewObject( #IFOCLASS_STRINGBOX, "StringBox_firstname",
{ x = 100, y = 55 },
{ x = 150, y = 20 },
{ Enabled = #IFO_ENABLED },
{ Values = { "" }, Lines = 1,
InputType = #GETKEY_ALL,
;Custom = "ABC123",
Clear1st = 1,
MaxLen = 100, },
{ OnExit = ButtonID, OnChange = ButtonID, OnKeyPress = ButtonID } )
;Last name
scui.NewObject( #IFOCLASS_LABEL, "Lable_lastname",
{ x = 10, y = 80 },
{ x = 90, y = 20 },
{ Bevel = { Colors = { Fill1 = { r=255, g=255, b=160} } },
Text = { FontName = "Diamond.font",
FontSize = 12,
Alignment = #TEXTALIGN_HCENTER } },
{ Values = { "Last Name" }, Lines = 1 } )
lastname = scui.NewObject( #IFOCLASS_STRINGBOX, "StringBox_lastname",
{ x = 100, y = 80 },
{ x = 150, y = 20 },
{ Enabled = #IFO_ENABLED },
{ Values = { "" }, Lines = 1,
InputType = #GETKEY_ALL,
;Custom = "ABC123",
Clear1st = 1,
MaxLen = 100, },
{ OnExit = ButtonID, OnChange = ButtonID, OnKeyPress = ButtonID } )
;Address line 1
scui.NewObject( #IFOCLASS_LABEL, "label_street1",
{ x = 10, y = 105 },
{ x = 110, y = 20 },
{ Bevel = { Colors = { Fill1 = { r=255, g=255, b=160} } },
Text = { FontName = "Diamond.font",
FontSize = 12,
Alignment = #TEXTALIGN_HCENTER } },
{ Values = { "Street Addr" }, Lines = 1 } )
address1 = scui.NewObject( #IFOCLASS_STRINGBOX, "StringBox_Address1",
{ x = 110, y = 105 },
{ x = 150, y = 20 },
{ Enabled = #IFO_ENABLED },
{ Values = { "" }, Lines = 1,
InputType = #GETKEY_ALL,
;Custom = "ABC123",
Clear1st = 1,
MaxLen = 100, },
{ OnExit = ButtonID, OnChange = ButtonID, OnKeyPress = ButtonID } )
;Address2
scui.NewObject( #IFOCLASS_LABEL, "lable_Address2",
{ x = 10, y = 130 },
{ x = 90, y = 20 },
{ Bevel = { Colors = { Fill1 = { r=255, g=255, b=160} } },
Text = { FontName = "Diamond.font",
FontSize = 12,
Alignment = #TEXTALIGN_HCENTER } },
{ Values = { "Address2" }, Lines = 1 } )
address2 = scui.NewObject( #IFOCLASS_STRINGBOX, "StringBox_Address2",
{ x = 100, y = 130 },
{ x = 150, y = 20 },
{ Enabled = #IFO_ENABLED },
{ Values = { "" }, Lines = 1,
InputType = #GETKEY_ALL,
;Custom = "ABC123",
Clear1st = 1,
MaxLen = 100, },
{ OnExit = ButtonID, OnChange = ButtonID, OnKeyPress = ButtonID } )
;City
scui.NewObject( #IFOCLASS_LABEL, "lable_city1",
{ x = 10, y = 155 },
{ x = 90, y = 20 },
{ Bevel = { Colors = { Fill1 = { r=255, g=255, b=160} } },
Text = { FontName = "Diamond.font",
FontSize = 12,
Alignment = #TEXTALIGN_HCENTER } },
{ Values = { "City" }, Lines = 1 } )
city = scui.NewObject( #IFOCLASS_STRINGBOX, "StringBox_City",
{ x = 100, y = 155 },
{ x = 150, y = 20 },
{ Enabled = #IFO_ENABLED },
{ Values = { "" }, Lines = 1,
InputType = #GETKEY_ALL,
;Custom = "ABC123",
Clear1st = 1,
MaxLen = 100, },
{ OnExit = ButtonID, OnChange = ButtonID, OnKeyPress = ButtonID } )
;Zipcode
scui.NewObject( #IFOCLASS_LABEL, "lable_zip",
{ x = 10, y = 180 },
{ x = 90, y = 20 },
{ Bevel = { Colors = { Fill1 = { r=255, g=255, b=160} } },
Text = { FontName = "Diamond.font",
FontSize = 12,
Alignment = #TEXTALIGN_HCENTER } },
{ Values = { "Zip Code" }, Lines = 1 } )
zipcode = scui.NewObject( #IFOCLASS_STRINGBOX, "StringBox_zip",
{ x = 100, y = 180 },
{ x = 150, y = 20 },
{ Enabled = #IFO_ENABLED },
{ Values = { "" }, Lines = 1,
InputType = #GETKEY_ALL,
;Custom = "ABC123",
Clear1st = 1,
MaxLen = 100, },
{ OnExit = ButtonID, OnChange = ButtonID, OnKeyPress = ButtonID } )
;State
scui.NewObject( #IFOCLASS_LABEL, "lable_state",
{ x = 10, y = 205 },
{ x = 90, y = 20 },
{ Bevel = { Colors = { Fill1 = { r=255, g=255, b=160} } },
Text = { FontName = "Diamond.font",
FontSize = 12,
Alignment = #TEXTALIGN_HCENTER } },
{ Values = { "State" }, Lines = 1 } )
state = scui.NewObject( #IFOCLASS_STRINGBOX, "StringBox_state",
{ x = 100, y = 205 },
{ x = 150, y = 20 },
{ Enabled = #IFO_ENABLED },
{ Values = { "" }, Lines = 1,
InputType = #GETKEY_ALL,
;Custom = "ABC123",
Clear1st = 1,
MaxLen = 100, },
{ OnExit = ButtonID, OnChange = ButtonID, OnKeyPress = ButtonID } )
;Phone
scui.NewObject( #IFOCLASS_LABEL, "lable_phone",
{ x = 10, y = 230 },
{ x = 90, y = 20 },
{ Bevel = { Colors = { Fill1 = { r=255, g=255, b=160} } },
Text = { FontName = "Diamond.font",
FontSize = 12,
Alignment = #TEXTALIGN_HCENTER } },
{ Values = { "Phone" }, Lines = 1 } )
phone = scui.NewObject( #IFOCLASS_STRINGBOX, "StringBox_phone",
{ x = 100, y = 230 },
{ x = 150, y = 20 },
{ Enabled = #IFO_ENABLED },
{ Values = { "" }, Lines = 1,
InputType = #GETKEY_ALL,
;Custom = "ABC123",
Clear1st = 1,
MaxLen = 100, },
{ OnExit = ButtonID, OnChange = ButtonID, OnKeyPress = ButtonID } )
;Email
scui.NewObject( #IFOCLASS_LABEL, "lable_email",
{ x = 10, y = 255 },
{ x = 90, y = 20 },
{ Bevel = { Colors = { Fill1 = { r=255, g=255, b=160} } },
Text = { FontName = "Diamond.font",
FontSize = 12,
Alignment = #TEXTALIGN_HCENTER } },
{ Values = { "Email" }, Lines = 1 } )
email = scui.NewObject( #IFOCLASS_STRINGBOX, "StringBox_email",
{ x = 100, y = 255 },
{ x = 130, y = 20 },
{ Enabled = #IFO_ENABLED },
{ Values = { "" }, Lines = 1,
InputType = #GETKEY_ALL,
;Custom = "ABC123",
Clear1st = 1,
MaxLen = 100, },
{ OnExit = ButtonID, OnChange = ButtonID, OnKeyPress = ButtonID } )
scui.NewObject( #IFOCLASS_LABEL, "lable_pick1",
{ x = 365, y = 55 },
{ x = 220, y = 40 },
{ Bevel = { Colors = { Fill1 = { r=255, g=255, b=160} } },
Text = { FontName = "Diamond.font",
FontSize = 12,
Alignment = #TEXTALIGN_HCENTER } },
{ Values = { "What do you think of the", "new show floor layout?" }, Lines = 2 } )
scui.NewObject( #IFOCLASS_OPTIONS,
"Options_1",
{ x = 365, y = 95 },
{ x = 220, y = 73 },
nil,
{ Rows = 3, Columns = 1,
Mode = #OPTMODE_ONLYONE,
Options = { "Perfect", "Ok", "Needs work" },
DefaultOptions = { 1 },
SwitchWidth = 20,
SwitchPosition = #OPT_LEFTSWITCH,
SwitchMode = #OPTSWITCH_NUMBER } )
scui.NewObject( #IFOCLASS_BUTTON,
"Button_1",
{ x = 10, y = 520 },
{ x = 189, y = 20 },
nil,
{ Values = { "Save!" }, Lines = 1 })
DebugPrint("READY")
Repeat
WaitEvent
Forever
tekmage