LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!
I have used this command before but it won't work now. reason given:
compiling at 11:41:09 AM
Type Chunk: can't create a variable with that name (explicitVariables?)
Object Clear
Line select before the text of fld "partNo"
Hint text
I just want to clear a bunch of flds and set the cursor to the first one.
on mouseUp
put "" into fld "partNo"
put "" into fld "description"
put "" into fld "Qty"
set the label of button "UOM" to ""
put "" into fld "No"
put "" into fld "DateRcd"
put "" into fld "DueDate"
put "" into fld "DateAllocated"
put "" into fld "TotalQTY"
set the label of button "UOM2" to ""
put "" into fld "$/UOM"
put "" into fld "$"
set the label of button "region" to ""
set the label of button "Store" to ""
put "" into fld "Location"
select before the text of fld "partNo"
end mouseUp
It looks like the error is wrong. The error should have been something like "wrong object reference" or "can't find object". The reason is that "the text of fld x" actually contains the text and no object reference. You want the text cursor to appear in a particular object and therefore you need to refer to that object rather than it's text:
Btw you can make a list with all field names and another list with all button names and use a repeat loop (two, actually). This would look like the following.
put "partNo,description,Qty,and more fields" into myFieldList
repeat for each item myField in myFieldList
put empty into fld myField
end repeat
put "UOM,UOM2,region,Store" into myButtonList
repeat for each item myButton in myButtonList
set the label of btn myButton to empty
end repeat
select before fld "PartNo"
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode