Append to Contextual Menus

Pete pete at mollysrevenge.com
Tue Aug 2 21:11:36 EDT 2011


I'm doing something similar but I have my own tools palette instead of the
IDE so I can configure the controls as they are dropped onto the card.  One
thing you might try is having a palette stack which has button it to set
your various validation options.  Select the control you want to insert
validation on, then click on the appropriate palette button.  The palette
button's on mouseUp handler would be:

set the Validation of selobj() to notempty

Depending on how far you want to go, you coauld have the button bring up a
dialog window with the current contents of the Validation cprop displayed
and let the user edit it/add to it/etc, then store the new value back into
the selected control.

Pete
Molly's Revenge <http://www.mollysrevenge.com>




On Tue, Aug 2, 2011 at 5:46 PM, Bob Sneidar <bobs at twft.com> 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.
>
> Bob
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>



More information about the use-livecode mailing list