Detecting SelectedObjectChanged When Clicking Another Control?

dunbarx at aol.com dunbarx at aol.com
Sat Sep 28 03:59:41 CEST 2013


Scott.


In the object of interest (mine was btn "b1"):



on mouseLeave
   if the selected of me then checkDeselect
end mouseLeave


on checkDeselect
   if not the selected of btn "b1" then
      put "Finally"
       exit to top
    end if
    send "checkDeselect" to me in 1
end checkDeselect


Craig



-----Original Message-----
From: Scott Rossi <scott at tactilemedia.com>
To: LiveCode Mail List <use-livecode at lists.runrev.com>
Sent: Fri, Sep 27, 2013 7:57 pm
Subject: Re: Detecting SelectedObjectChanged When Clicking Another Control?


Hi Craig:

If I understand what you're proposing, you would need to place the script
that handles the selection detection at the card or stack level, or in a
front or backScript.  This is what I'm doing already (backScript), and it
works fine.  But I'm looking for an object-level method that doesn't need
to track *all* selections.  I should have explained this better.

>From what I've found, the clicked object itself can detect when it is
selected, but I'm hoping there's an object-level option that tells it when
it's *deselected*.

Regards,

Scott Rossi
Creative Director
Tactile Media, UX/UI Design




On 9/27/13 4:43 PM, "dunbarx at aol.com" <dunbarx at aol.com> wrote:

>Scott.
>
>
>Oh, I see, you want to know when you deselect, and there is no
>"deSelectedObjectChanged" message.
>
>
>Can't you set a custom property when the object of interest is selected,
>and check the target when the "selectedObjectChanged" message fires, and
>if that new target is not that original object, let you know?
>
>
>Craig
>
>
>
>-----Original Message-----
>From: Scott Rossi <scott at tactilemedia.com>
>To: LiveCode Mail List <use-livecode at lists.runrev.com>
>Sent: Fri, Sep 27, 2013 7:16 pm
>Subject: Detecting SelectedObjectChanged When Clicking Another Control?
>
>
>Hi All:
>
>I recently ran into a situation where I need to trap selectedObjectChanged
>after clicking on something other than the selected control (as opposed to
>clicking on the card where nothing is selected).  Can you detect this
>without resorting to a front/backScript or a card/stack-level script?
>
>I have a control that changes its state when it is selected, and I need to
>revert that state when the object is deselected.  Starting with the
>selected control, if I click on the card (click nothing), the control gets
>the selectedObjectChanged message and can be reset.  But if I click on
>another object, there doesn't seem to be a built-in way for the control to
>detect this.
>
>I've resorted to loading a backScript to tell the original control that it
>has been deselected, but this seems fragile and I'm wondering if there's a
>better way to handle this.
>
>Thanks for suggestions.
>
>Regards,
>
>Scott Rossi
>Creative Director
>Tactile Media, UX/UI Design
>
>
>
>_______________________________________________
>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
>
> 
>_______________________________________________
>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
>



_______________________________________________
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