Pastey MFTest.exu to demo some more advanced Fdialogs features
- Posted by ChrisB
(moderator)
Sep 18, 2011
--MixedForm test
without warning
global constant TRUE = 1, FALSE = 0
object VOID
include Fdialogs.ex
sequence result
result = {}
-------------------------------------------------------------------------------------------------------------
function test_mixed_form()
-------------------------------------------------------------------------------------------------------------
SetColors(WHITE, BLACK)
SetStyle(5) position(1,1) MessageBox("",{}) SetStyle(1) --need this so that screen clears properly
clear_screen()
while 1 do
SetSize(20,60)
result = MixedForm("Test", {BRIGHT_WHITE, BLUE}, 1, 1,
{ {MF_LABEL, 3, 3, "Boooo"},
{MF_LABEL, 4, 3, "HOOOO"},
{MF_TEXT, 3, 10, 20, ""},
{MF_TEXT, 4, 10, 20, "And hoo 2 u 2 - lets see what happens if its longer than the field"},
{MF_CHECK, 6, 3, FALSE, "Unchecked"},
{MF_CHECK, 7, 3, TRUE, "Checked"},
{MF_DROPLIST, 9, 3, 20, 5, {"Oranges","Apples", "Pears", "Bananas"}, 2},
{MF_BUTTON, 11, 3, 15, 1, "Test Button"}
}
)
exit
end while
clear_screen()
puts(1, "First text box " & result[3] & "\n")
puts(1, "2nd text box " & result[4] & "\n")
puts(1, "First check box " & result[5] & "\n")
puts(1, "2nd check box " & result[6] & "\n")
puts(1, "Droplist " & result[7])
printf(1, "\nTest button result %d\n", {result[8]})
return 1
end function
-------------------------------------------------------------------------------------------------------------
function test_list_selection()
-------------------------------------------------------------------------------------------------------------
sequence list_1, list_2, result
list_1 = { "Apples",
"Oranges",
"Pears",
"Bananas",
"Mangos",
"Strawberries"
}
list_2 = { "Pizzas",
"Sausages"
}
list_2 = {}
--set usual position, colour, size
position(2,2)
SetColors(YELLOW, BLACK)
SetSize(10, 40)
result = SelectMultiList("From", "To", list_1, list_2)
list_1 = result[1]
list_2 = result[2]
puts(1, "\nmulti_select_list test \nlist_1 :-\n")
for i = 1 to length(list_1) do
puts(1, list_1[i] & "\n")
end for
puts(1, "\nlist_2 :-\n")
for i = 1 to length(list_2) do
puts(1, list_2[i] & "\n")
end for
VOID = wait_key()
return 1
end function
-------------------------------------------------------------------------------------------------------------
-- Main
-------------------------------------------------------------------------------------------------------------
VOID = test_mixed_form()
VOID = test_list_selection()