Append to Contextual Menus
Bob Sneidar
bobs at twft.com
Tue Aug 2 20:46:29 EDT 2011
Hi all.
This may have been discussed before. I want to add a contextual menu to fields in addition to the one the IDE is presenting, so I can add things like validations while in edit mode. Is there a way to do this without overriding the standard contextual menus? This can be filed as so obscure as not needing a reply, but I have been thinking about a method for enabling validations for fields in edit mode using a right click or something. I could hack it by selecting the field and then running something in the message box, but wouldn't that be a cool plugin?
For instance I have a notempty validation I use:
on notEmpty theField
-- returns false in the result if the field is empty, otherwise returns true
put true into theResult
if field theField is empty then
put "lbl" & char 4 to -1 of theField into theFieldLabel -- all my fields start with "fld"
put the text of field theFieldLabel into theFieldName
answer theFieldName && "cannot be empty!"
select the text of field theField
put false into theResult
end if
return theResult
end notEmpty
If the field has a property called Validations, and notEmpty is one of the lines of that property, then this command will be called. I have a concat validation that will concatenate a list of fields and put it in another field, I have a noupdate validation that deletes the key in an array before updating the database, so that something like a password can only be created when creating a new record, and requires another handler to change it.
I would love to be able to assign these validations with a right-click of the mouse. I will share all my validations at some point.
Bob
More information about the use-livecode
mailing list