Update button icon

Ken Ray kray at sonsothunder.com
Fri Mar 5 18:45:23 EST 2004


Tom,

SetProp is triggered when a custom property is about to be set; if you
pass the setProp it actually sets the property. This gives you an
opportunity to prevent it from being set, or to do something based on
what value the property is about to be set to, etc.

Here's an example:

on mouseUp
  set the age of btn 1 to 100
end mouseUp

setProp age pValue
  if pValue < 100 then
    answer "Age is less than 100"
  else
    answer "Age is 100 or more. Is that OK?" with "Yes" or "No"
    if it is "No" then exit age  -- doesn't set property
  end if
  pass age
end age

Note that it can only be used for custom properties - you can't do a
setProp on the visible of an object, for example.

HTH,

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/ 

> -----Original Message-----
> From: use-revolution-bounces at lists.runrev.com 
> [mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of 
> Thomas McGrath III
> Sent: Friday, March 05, 2004 4:22 PM
> To: How to use Revolution
> Subject: Re: Update button icon
> 
> 
> Chris,
> 
> That is exactly what I want.
> If it works I will be a happy puppy.
> 
> Does setProp get sent when a custom prop is changed? So i would then 
> trap a setProp message and update there?
> Or do I use setProp to set the prop of a custom property?
> 
> Thank you,
> 
> Tom
> 
> On Mar 5, 2004, at 11:45 AM, Chris Sheffield wrote:
> 
> > Have you checked out the getProp and setProp handlers?  You can use
> > setProp
> > to run any code you want when a custom property's value is 
> changed.  
> > Maybe
> > that's what you want?
> >
> > Chris Sheffield
> > Software Development
> > Read Naturally
> >
> >
> >
> > -----Original Message-----
> > From: use-revolution-bounces at lists.runrev.com
> > [mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of Thomas
> > McGrath
> > III
> > Sent: Thursday, March 04, 2004 4:59 PM
> > To: How to use Revolution
> > Subject: Re: Update button icon
> >
> >
> > I'm using a custom prop to store if the button it self is a 
> big yellow 
> > one or a non-yellow one. Then via scripting the next time 
> the button 
> > is hit it asks for the custom prop cYellow and if true sets 
> the state 
> > to a yellow button. However,
> > I want to (without setting the icon itself ) have it update
> > using the custom prop without having to click the button.
> >
> > It is confusing because I am manually setting the button states for 
> > three buttons in a group on top of each other. button layer 
> 1 is the 
> > yellow or not base button button layer 2 is the icon of the button
> > button layer 3 is the available of the button ( a gray 
> button that says
> > it is not available BUT can be used to reset the others)
> >
> > So I want to set the cYellow of a button and tell the button to go 
> > ahead and check the cYellow and update but not actually click the 
> > button to do it.
> >
> > I guess I could check the button's cYellow and change the 
> icon my self 
> > but I was hoping once set there could be an update or something.
> >
> > TOm
> >
> >
> > On Mar 4, 2004, at 5:20 PM, Chris Sheffield wrote:
> >
> >> Tom,
> >>
> >> Maybe I'm not understanding exactly what you're wanting to do, but 
> >> can't you just set the icon of the button using "set the 
> icon of btn 
> >> "myButton" to
> >> 1001" (inserting the correct id number, of course).  Is 
> this not what
> >> you
> >> want?  You can also set hilitedIcon, armedIcon, and others 
> if needed.
> >>
> >> Chris Sheffield
> >> Software Development
> >> Read Naturally
> >>
> >>
> >>
> >> -----Original Message-----
> >> From: use-revolution-bounces at lists.runrev.com
> >> [mailto:use-revolution-bounces at lists.runrev.com] On Behalf 
> Of Thomas 
> >> McGrath III
> >> Sent: Thursday, March 04, 2004 3:10 PM
> >> To: How to use Revolution
> >> Subject: Re: Update button icon
> >>
> >>
> >> Ken,
> >>
> >> Then it updates, BUT that is not what I want. I have 
> recorded scripts 
> >> that would run on a click and so I don't want to do that. I need 
> >> something like: update page or update button to force the 
> new icon to 
> >> appear after setting it without executing the button.
> >>
> >> I wonder if focus does anything???
> >>
> >> I will go check.
> >>
> >> TOm
> >>
> >> On Mar 4, 2004, at 5:04 PM, Ken Norris wrote:
> >>
> >>> Hi Tom,
> >>>
> >>>> Date: Thu, 4 Mar 2004 14:42:37 -0500
> >>>> From: Thomas McGrath III <3mcgrath at adelphia.net>
> >>>> Subject: Update button icon
> >>>>
> >>>> Hey All,
> >>>
> >>>> Right now I have to click at it to get it to update.
> >>> -----------
> >>> What happens if you send it a click?
> >>>
> >>> on updateIcon
> >>>   changeIcon ## whatever your handler to change the icon is
> >>>   click at the loc of btn whichButton
> >>> end updateIcon
> >>>
> >>> Ken N.
> >>>
> >>> _______________________________________________
> >>> use-revolution mailing list
> >>> use-revolution at lists.runrev.com 
> >>> http://lists.runrev.com/mailman/listinfo/use-revolution
> >>>
> >>>
> >>
> >> Thomas J. McGrath III
> >> SCS
> >> 1000 Killarney Dr.
> >> Pittsburgh, PA 15234
> >> 412-885-8541
> >>
> >> _______________________________________________
> >> use-revolution mailing list
> >> use-revolution at lists.runrev.com 
> >> http://lists.runrev.com/mailman/listinfo/use-revolution
> >>
> >> ---
> >> Incoming mail is certified Virus Free.
> >> Checked by AVG anti-virus system (http://www.grisoft.com).
> >> Version: 6.0.611 / Virus Database: 391 - Release Date: 3/3/2004
> >>
> >>
> >> ---
> >> Outgoing mail is certified Virus Free.
> >> Checked by AVG anti-virus system (http://www.grisoft.com).
> >> Version: 6.0.611 / Virus Database: 391 - Release Date: 3/3/2004
> >>
> >>
> >> _______________________________________________
> >> use-revolution mailing list
> >> use-revolution at lists.runrev.com 
> >> http://lists.runrev.com/mailman/listinfo/use-revolution
> >>
> >>
> >
> > Thomas J. McGrath III
> > SCS
> > 1000 Killarney Dr.
> > Pittsburgh, PA 15234
> > 412-885-8541
> >
> > _______________________________________________
> > use-revolution mailing list
> > use-revolution at lists.runrev.com 
> > http://lists.runrev.com/mailman/listinfo/use-revolution
> >
> > ---
> > Incoming mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.611 / Virus Database: 391 - Release Date: 3/3/2004
> >
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.611 / Virus Database: 391 - Release Date: 3/3/2004
> >
> >
> > _______________________________________________
> > use-revolution mailing list
> > use-revolution at lists.runrev.com 
> > http://lists.runrev.com/mailman/listinfo/use-revolution
> >
> >
> 
> Thomas J. McGrath III
> SCS
> 1000 Killarney Dr.
> Pittsburgh, PA 15234
> 412-885-8541
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com 
> http://lists.runrev.com/mailman/listinfo/use-> revolution
> 




More information about the use-livecode mailing list