Looking for help with a survey app for Amiwest

Find quick help here to get you started with Hollywood
Post Reply
tekmage
Posts: 2
Joined: Thu Oct 20, 2011 8:30 am

Looking for help with a survey app for Amiwest

Post by tekmage » 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:

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     
Thank you!
tekmage

User avatar
Clyde
Posts: 198
Joined: Sun Feb 14, 2010 12:38 pm
Location: Dresden / Germany

Re: Looking for help with a survey app for Amiwest

Post by Clyde » Fri Oct 21, 2011 10:00 pm

Hi tekmage,

first, welcome to the forums! I think it is really cool that you use Hollywood and ScuiLib for some AmiWest stuff! Great!

I tried to compile and start your example but I always get an error as soon as the first scui object is created: "Table field "selecteddisplay" was not defined" -> @Allanon???

Besides that, regarding your questions:

First, you have to extend the code of you save button definition a little bit, as you have to add

Code: Select all

{ OnPushed = WriteData }
where WriteData is the callback function which will be processed after you pressed the button. So your button definition should look like this:

Code: Select all

scui.NewObject( #IFOCLASS_BUTTON,
                "Button_1",
                { x =  10, y =  520 },
                { x = 189, y =  20 },
                nil,
                { Values = { "Save!" }, Lines = 1 },
                { OnPushed = WriteData })
I guess, with the help of the manual you should be able to find out how to handle write data to a file. If you need help with that, just let us know.

Clearing a string box is relatively straight forward. E.g. if you like to clear your "StringBox_firstname" just set its value to an empty string like this:

Code: Select all

scui.Set("StringBox_firstname", { Value = "" }, 1)
I hope this will help you. If you have any (more) questions, please feel free to ask!

Greetings
Currently using: Hollywood 8 with Windows IDE

User avatar
Allanon
Posts: 461
Joined: Sun Feb 14, 2010 7:53 pm
Location: Italy
Contact:

Re: Looking for help with a survey app for Amiwest

Post by Allanon » Sat Oct 22, 2011 7:31 pm

Hello Tekmage and thank you for using Scuilib :D
What's said by Clyde is correct but I've found some more problems, the first one is the missing initialization function, instead of using ChangeDisplay & MoveDisplay directly you have to use the scui.Initialize() function:

Code: Select all

scui.Initialize({ Title      = "My program",
                  Size       = { 610, 550 },
                  Position   = { #CENTER, #CENTER }})
There is another problem: by default Scuilib theme uses a default internal font #SANS with antialiasing switched on, but if you like to use the diamond font you have to switch antialiasing off because this font type does not support it, so I've corrected your code to switch this flag off during the objects creation.
Otherwise you can leave the default font or use a font that supports antialiasing (TrueType fonts).

Last problem: the latest Scuilib version uses some new functions for button handling so you should use these to define button gadgets instead of the old methods, Ive corrected the code so you can see how it work now.

You new code is:

Code: Select all


; SCUI SHOWCASE
; -----------------------------------------------------------------------------
@INCLUDE "ScuiLib.hws"
; -----------------------------------------------------------------------------

; Problem #1 : Missing < scui.Initialize() > function
scui.Initialize({ Title      = "My program",
                  Size       = { 610, 550 },
                  Position   = { #CENTER, #CENTER }})


; Problem #2 : text style must be set to NORMAL to switch-off the antialias
;              used by default
; Since you are using diamond as default font and this font does not support
; antialiasing you have to hack the default value in you gadget's definitions :)
text_style = #TEXTSTYLE_NORMAL

; Problem #3 : you should use the new class used for buttons
;              scui.Button.Add()

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,
                                Style = text_style,
                                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,
                                Style = text_style,
                                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,
                                Style = text_style,
                                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,
                                Style = text_style,
                                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,
                                Style = text_style,
                                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,
                                Style = text_style,
                                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,
                                Style = text_style,
                                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,
                                Style = text_style,
                                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,
                                Style = text_style,
                                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,
                                Style = text_style,
                                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,
                                Style = text_style,
                                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.Button.Add( { Position = { x = 10, y = 520 },
                   Size = { w = 189, h = 20 },
                   Name = "Button_1",
                   Caption = { "Save!" },
                   Actions = { OnPushed = Your_Write_Function_Here },                        ; <--- here you add the function to be called by pressing the button
                   } )
/*
scui.NewObject( #IFOCLASS_BUTTON,
                "Button_1",
                { x =  10, y =  520 },
                { x = 189, y =  20 },
                nil,
                { Values = { "Save!" }, Lines = 1 })
*/

DebugPrint("READY")

Repeat
  WaitEvent
Forever
Hope this helps! Please feel free to ask for whatever dubt or problem you may have :D
----------------------------
[Allanon] Fabio Falcucci
AMC - Creative Development // Docs Site // Support Forum
Support me on Patreon for Hollywood libraries!

Bugala
Posts: 825
Joined: Sun Feb 14, 2010 7:11 pm

Re: Looking for help with a survey app for Amiwest

Post by Bugala » Sat Oct 22, 2011 9:37 pm

Depending what you mean to do with your program, one possibility for saving and loading and clearing survey forms would be to use SaveTable() and ReadTable() commands.

By other word it would go about this way (not real working code):

Code: Select all

form = {}
Everytime new info is stored:

Code: Select all

form = readtable("file")
n = n + 1

form[n].name = nameanswerinform
form[n].answer1 = answer1inform


savetable(form, "file")
to clear some info:

Code: Select all

form[n] = {}
or make some function to do that:

Code: Select all

function p_ClearForm(n)

form[n] = {Name = "Please give your name", answer1 = "Please Give Answer")
endfunction
and then naturally made something like p_UpdateForm(n) that you can use to update the forms info with info contained in chosen form[n], which could be the basic empty info to help user fill the form even easier.

tekmage
Posts: 2
Joined: Thu Oct 20, 2011 8:30 am

Re: Looking for help with a survey app for Amiwest

Post by tekmage » Wed Nov 02, 2011 7:33 pm

Hi All!

Thanks for the help. Sadly this year I was too busy prepping the video feed to get the survey form done. The code I provided was lifted from the SCUIlib examples. From the responses it sounds like there are some issues with the sample code that ships with Hollywood.

I think I'll get the formed updated and see about shipping the results back to a webserver and release it for anyone to provide feedback. Let me make the suggested changes and I'll let you all know how it goes!

Cheers,
Bill

Post Reply