Append to Contextual Menus
john at splash21.com
Wed Aug 3 06:01:53 EDT 2011
Here's a slightly modified version;
stick the following in a frontscript to modify the context menu only for
field objects - you can refine further as required.
on revHookBuildObjectEditorContextMenu pMenuTarget, pMenuName, @pMenu,
if pMenuName = "Field" then
put "Customize field" & LF & "-" & LF before pMenu
function dispatchContextMenuPick pMenuName, pWhich
if pWhich = "Customize field" then
answer "Do your field customization!"
exit to top
On 03/08/2011 10:53, John Craig wrote:
> Check out LiveCode.TV
> On 03/08/2011 01:46, Bob Sneidar wrote:
>> 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.
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
More information about the Use-livecode