View Full Version : Clear all project Input Objects at once?
ronwilliams
06-12-2009, 06:41 PM
Is this possible?
I want AMS to clear all Input Objects throughout the project when the user returns to page One.....
I have no idea how to do this...
Thanks
Imagine Programming
06-12-2009, 07:21 PM
It can only be done one page at a time.
Page1, On Show Remember, this will only clear the inputs in page 1
local tObjects = Page.EnumerateObjects();
if(tObjects)then
for i, sObject in tObjects do
if(Page.GetObjectType(sObject)==OBJECT_INPUT)then
Input.SetText(sObject, "");
end
end
end
ronwilliams
06-13-2009, 03:42 AM
Thanks, that is what I thought!
So basically I will have to quite and then restart the AMS project to clear all?
Imagine Programming
06-13-2009, 03:57 AM
Or you put it on every page's On Show event. Or you use variables.
Page 1 On Show
Input1_Content = "";
Input2_Content = "";
--etc.
And on the other pages On Show event you place
Input.SetText("Input2', Input2_Content);
and while you are on that page you could use the On Key event in the input
to set Input2_Content every keystroke.
Input2_Content = Input.GetText(this);
MicroByte
06-13-2009, 04:02 AM
just wrap the above code in a function and call it from each page or dialog
function ClearAllInputs(FormType)
local tObjects = FormType.EnumerateObjects();
if(tObjects)then
for i, sObject in tObjects do
if(Page.GetObjectType(sObject)==OBJECT_INPUT)then
Input.SetText(sObject, "");
end
end
end
end
-- call from page
ClearAllInputs(Page)
-- call from dialog
ClearAllInputs(DialogEx)
Edit, lol post same time:yes
Imagine Programming
06-13-2009, 10:12 AM
Haha yeah, but your way is nicer lol, why didn't I think of that. I like your way of dealing with Page/DialogEx troubles hehe :yes
MicroByte
06-13-2009, 12:32 PM
yeah the DialogEx system broke most of my page wide functions so i updated them with the same system, whenever i make a function that calls a "Page" action i always throw in that switch in case i ever need it in a dialog.
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.