
% Some validation tests and examples for the Qt version of UI dialogs.
% Dan Sebald 2013apr01

qterrordlg ("Error!")
qterrordlg ("Error!", "qterrordlg")
try
  qterrordlg ("Hello", "Third", "World");
catch
  display ("Properly found error.");
end_try_catch
qtwarndlg ("Warning!")
qtwarndlg ("Warning!", "qtwarndlg")
qthelpdlg ("Help!")
qthelpdlg ("Help!", "qthelpdlg")
qthelpdlg ("This\nis\nfrom\na\nstring")
qtmsgbox ({"Secret" "Messages"}, "error msgbox", "error")
qtmsgbox ({"Secret" "Messages"}, "warn msgbox", "warn")
qtmsgbox ({"Secret" "Messages"}, "help msgbox", "help")
qtmsgbox ({"Secret" "Messages"}, "msgbox", "none")
qtmsgbox ({"This" "is" "from" "a" "cell"}, "msgbox", "help")
qtquestdlg ("qtquestdlg with ONE argument")
qtquestdlg ("Qtquestdlg with TWO arguments", "Default Default")
qtquestdlg ("Qtquestdlg with THREE arguments", "Yes Default", "Yes")
qtquestdlg ("Qtquestdlg with THREE arguments", "No Default", "No")
qtquestdlg ("Qtquestdlg with THREE arguments", "Cancel Default", "Cancel")
qtquestdlg ("Qtquestdlg with FOUR arguments", "Two Buttons", "Button 1", "Button 2")
qtquestdlg ("Qtquestdlg with FIVE arguments", "Button1 Default", "Button 1", "Button 2", "Button 1")
qtquestdlg ("Qtquestdlg with FIVE arguments", "Button2 Default", "Button 1", "Button 2", "Button 2")
qtquestdlg ("Qtquestdlg with SIX arguments", "Button2 Default", "Button 1", "Button 2", "Button 3", "Button 2")
ans = qtquestdlg ("Are you ready Steve?", "Brian", "No", "Uh huh", "Uh huh")
if (!strcmp (ans, "No"))
  ans = qtquestdlg ("Andy?", "Brian", "No", "Yeah", "Yeah")
  if (!strcmp (ans, "No"))
    ans = qtquestdlg ("Mick?", "Brian", "No", "Okay", "Okay")
    if (!strcmp (ans, "No"))
      ans = qtmsgbox ("Well all right, fellas.    \n\n     Let''s GO!!!!!", "Brian", "none")
    endif
  endif
endif
[sel, ok] = qtlistdlg ("ListString", {"Two of Diamonds","Seven of Clubs","Five of Spades","King of Clubs","Nine of Spades","Jack of Diamonds"}, "PromptString", "Pick a card, any card:", "SelectionMode", "Single", "OKString", "Pick", "CancelString", "No Thanks", "Name", "Deck Shuffle")
[sel, ok] = qtlistdlg ("ListString", {"Orange","Hazel Nut","Cauliflower","Dark Chocolate","Olive","Apple","Grape","Tomato","Apricot","Carrot","Strawberry","Walnut","Eggplant","Almonds","Pepper","Blueberry","Asparagus","Mission Fig","Raspberry"}, "InitialValue", [3 5], "PromptString", "Pick as many as you like:","Name","Good Food", "SelectionMode", "Multiple")
[sel, ok] = qtlistdlg ("ListString", {"Neutron","Electron","Quark","Proton","Neutrino"},"Name","Bits and Pieces","ListSize",[200 75])
qtinputdlg ({"Input 1:","Input 2:","Input 3:"})
qtinputdlg ({"Input 1:","Input 2:","Input 3:"}, "qtinputdlg")
qtinputdlg ({"Length:","Width:","Height"}, "Different Row Height", 2)
qtinputdlg ({"Too Small:","Too Big:","Just Right:"}, "Variable Row Height", [0.3 3 1], {"Can you read this?","Whoa!","Ahhh"})
qtinputdlg ({"Entry 1:","Entry 2:","Entry 3:"}, "Variable Row Height and Column Width", [1 2; 3 4; 5 6])
qtinputdlg ({"Einstein:","Newton:","Planck:"}, "Most General Example", [1 7; 1 11; 1 20], {"E = m c^2","F = G m1 m2 / r^2","B = 2 h v^3 / (c^2 (e^(h v/(k T)) - 1))"})

