Hey guys,
Need a little help. I am trying to figure out how to use or (re-use buttons). I have a button to fire a script.
eg I have a sketch and when you press the button it runs around the playfield.
I want to be able to click the button a second time to stop the script.
I have tried many things but just cannot quite get there. Any suggestions?? Thanks
Regards
Kelly
_______________________________________________ Squeakland mailing list [hidden email] http://squeakland.org/mailman/listinfo/squeakland |
Hi Kelly,
> > Need a little help. I am trying to figure out how to use or (re-use > buttons). I have a button to fire a script. > eg I have a sketch and when you press the button it runs around the > playfield. > > I want to be able to click the button a second time to stop the > script. > > I have tried many things but just cannot quite get there. Any > suggestions?? Thanks You could ask the label of your button, if it says: "run" then run the sketch _and_ change the label to "stop", and if it says "stop" vice versa. "What makes sense to the user, often makes sense to the developer too..." ;-) Cheers, Markus _______________________________________________ Squeakland mailing list [hidden email] http://squeakland.org/mailman/listinfo/squeakland |
In reply to this post by Kelly-10
I made a numeric variable and a test that
checks for odd/even numbers. The button adds to the counter causing the button
to act like a start/stop button. See an image of this script here: http://www.flickr.com/photos/60167034@N00/103835867/ arvind From:
[hidden email] [mailto:[hidden email]] On Behalf Of Kelly Hey guys, Need a little help. I am trying to figure out how to use or (re-use
buttons). I have a button to fire a script. eg I have a sketch and when you press the button it runs around the
playfield. I want to be able to click the button a second time to stop the script.
I have tried many things but just cannot quite get there. Any
suggestions?? Thanks Regards Kelly _______________________________________________ Squeakland mailing list [hidden email] http://squeakland.org/mailman/listinfo/squeakland |
In reply to this post by Kelly-10
Hi Kelly,
A possible solution might be to use two scripts: the first on does the spinning, the second one is reponsible of start and stop of the spinning and uses a Boolean variable of the figure. See the attached screenshot Markus ----------------------------------------------- Markus Schlager m.slg(at)gmx.de buttonStartStop.png (60K) Download Attachment |
In reply to this post by Kelly-10
Hi Kelly,
This works for me. Make a new variable by clicking the sketch's (v) button (right next to its name in the Viewer flap for the the sketch). Give the field a name, like motionToggle. Now make a script with a test. For the "test" part of the test structure, drag the new variable out of the flap and into the "test". Change the condition to "= true". Put your sketch motion in the "Yes" part of the test. Check that the motionToggle variabe works controling the motion by toggling it from true to false in the flap. Now on you button click script add another test. If motionToggle is "true" assign it "false". If motionToggle is "fales" assign it "true". The attached gifs are similar to what you need, but not exactly . Let us know if you need more help. Cheers, Darius _______________________________________________ Squeakland mailing list [hidden email] http://squeakland.org/mailman/listinfo/squeakland VariableButton.gif (2K) Download Attachment VariableAssignment.gif (3K) Download Attachment SketchTest.gif (6K) Download Attachment ButtonTest.gif (7K) Download Attachment |
You can also toggle the button's color or text on click and then have the sketch's motion script test the button's color or text.
Cheers, Darius On 2/24/06,
Darius Clarke <[hidden email]> wrote: Hi Kelly, _______________________________________________ Squeakland mailing list [hidden email] http://squeakland.org/mailman/listinfo/squeakland |
In reply to this post by Kelly-10
Hi Kelly,
A simple way to do this is using two buttons one for run and one for stop. In the script for run you hide the button for run and show the button for stop In the script for stop ou hide the button for stopand show the button for run Then put the buttons at the same place. >From the menu of a script editor, you can get a button for running the script. The commands hide and show are in the miscelanous category see attached project ________________________________ De: [hidden email] de la part de Kelly Date: ven. 24.02.2006 13:05 À: [hidden email] Objet : [Squeakland] newbie(ish) question (buttons) Hey guys, Need a little help. I am trying to figure out how to use or (re-use buttons). I have a button to fire a script. eg I have a sketch and when you press the button it runs around the playfield. I want to be able to click the button a second time to stop the script. I have tried many things but just cannot quite get there. Any suggestions?? Thanks Regards Kelly _______________________________________________ Squeakland mailing list [hidden email] http://squeakland.org/mailman/listinfo/squeakland example stop run.001.pr (54K) Download Attachment |
In reply to this post by Kelly-10
An other solution using the color of the button instead of a variable to control the state.
see attachment Regards ________________________________ De: [hidden email] de la part de Kelly Date: ven. 24.02.2006 13:05 À: [hidden email] Objet : [Squeakland] newbie(ish) question (buttons) Hey guys, Need a little help. I am trying to figure out how to use or (re-use buttons). I have a button to fire a script. eg I have a sketch and when you press the button it runs around the playfield. I want to be able to click the button a second time to stop the script. I have tried many things but just cannot quite get there. Any suggestions?? Thanks Regards Kelly _______________________________________________ Squeakland mailing list [hidden email] http://squeakland.org/mailman/listinfo/squeakland stop-start.gif (18K) Download Attachment |
In reply to this post by Markus Schlager-2
Hey guys,
The answer seems so obvious now! That's always the way I guess.
Thank you for all your suggestions, it's most appreciated.
Regards Kelly.
PS Markus I decided to go with your suggestion, thanks!
On 24/02/06, Markus Schlager <[hidden email]> wrote:
Hi Kelly, _______________________________________________ Squeakland mailing list [hidden email] http://squeakland.org/mailman/listinfo/squeakland |
In reply to this post by Kelly-10
Hi Squeakers.
I wonder if I've missed something. How can I create a 'Label' of a button? (I think a 'button' is something I've drawn and now tell it to act upon mouse-down, isn't it?) If a Label means text embedded into a drawing, how can I change that text? Sincerely, Uwe -----Original Message----- From: [hidden email] [mailto:[hidden email]]On Behalf Of Markus Gaelli Sent: Friday, February 24, 2006 2:32 PM To: [hidden email] Subject: Re: [Squeakland] newbie(ish) question (buttons) Importance: High Hi Kelly, > > Need a little help. I am trying to figure out how to use or (re-use > buttons). I have a button to fire a script. > eg I have a sketch and when you press the button it runs around the > playfield. > > I want to be able to click the button a second time to stop the > script. > > I have tried many things but just cannot quite get there. Any > suggestions?? Thanks You could ask the label of your button, if it says: "run" then run the sketch _and_ change the label to "stop", and if it says "stop" vice versa. "What makes sense to the user, often makes sense to the developer too..." ;-) Cheers, Markus _______________________________________________ Squeakland mailing list [hidden email] http://squeakland.org/mailman/listinfo/squeakland _______________________________________________ Squeakland mailing list [hidden email] http://squeakland.org/mailman/listinfo/squeakland |
Hi Uwe,
indeed, my mail was a bit short... ;-) Two ways of doing it: 1.) Assuming you are using an up-to-date squeakland-image click on the color-pipette-halo of your morph (might be chift-click, depends on the morph, haven't explored the differences yet) and then the button labeled "button" on the bottom. ;-) There you can add a label. You can set the text of the label by opening a viewer on it. Go to the "text"-category and type in your label in the characters setter. (It is a bit strange that one cannot change the label in the dialog directly). From there you can also drag put the label setter for reasons described in my last mail below. 2.) Take out a text morph of the supplies-flap, embed it into your button, and proceed as above. The advantage of doing so is that you can change the text and the font directly. Cheers, Markus p.s. I actually found out about the first option only last week, after sending below mail. EToys for the constructivistic explorer: "Always get a new surprise feature from time to time..." ;-) On Mar 1, 2006, at 1:08 PM, Hübner, Uwe wrote: > Hi Squeakers. > > I wonder if I've missed something. > How can I create a 'Label' of a button? > (I think a 'button' is something I've drawn and > now tell it to act upon mouse-down, isn't it?) > If a Label means text embedded into a drawing, > how can I change that text? > > Sincerely, > > Uwe > > -----Original Message----- > From: [hidden email] > [mailto:[hidden email]]On Behalf Of Markus Gaelli > Sent: Friday, February 24, 2006 2:32 PM > To: [hidden email] > Subject: Re: [Squeakland] newbie(ish) question (buttons) > Importance: High > > > Hi Kelly, > >> >> Need a little help. I am trying to figure out how to use or (re-use >> buttons). I have a button to fire a script. >> eg I have a sketch and when you press the button it runs around the >> playfield. >> >> I want to be able to click the button a second time to stop the >> script. >> >> I have tried many things but just cannot quite get there. Any >> suggestions?? Thanks > > You could ask the label of your button, if it says: "run" then run > the sketch > _and_ change the label to "stop", and if it says "stop" vice versa. > > "What makes sense to the user, often makes sense to the developer > too..." ;-) > > Cheers, > > Markus > _______________________________________________ > Squeakland mailing list > [hidden email] > http://squeakland.org/mailman/listinfo/squeakland _______________________________________________ Squeakland mailing list [hidden email] http://squeakland.org/mailman/listinfo/squeakland |
In reply to this post by "Hübner, Uwe"
Dear Markus,
thanks for the 'extended' answer. Unfortunately I could not follow your description. I did the following: 1. I worked with Squeakland image 3.8-05 latest update: #531 2. I drew an 'Ellipse' and filled it (that should become my 'button') 3. The balloon of the 'color-pipette-halo' says: 'Repaint'. Shift-Click: Back in the paint tool. Ctrl-Click: I get a menu (must be the same for every halo) that lists: grab copy to paste buffer delete . . . debug But neither a button, nor an entry 'button'. Cheers, Uwe -----Original Message----- From: Markus Gaelli [mailto:[hidden email]] Sent: Wednesday, March 01, 2006 1:32 PM To: Hübner, Uwe Cc: Squeakland Subject: Re: Label of a button Was: RE: [Squeakland] newbie(ish) question (buttons) Importance: High Hi Uwe, indeed, my mail was a bit short... ;-) Two ways of doing it: 1.) Assuming you are using an up-to-date squeakland-image click on the color-pipette-halo of your morph (might be chift-click, depends on the morph, haven't explored the differences yet) and then the button labeled "button" on the bottom. ;-) There you can add a label. You can set the text of the label by opening a viewer on it. Go to the "text"-category and type in your label in the characters setter. (It is a bit strange that one cannot change the label in the dialog directly). From there you can also drag put the label setter for reasons described in my last mail below. 2.) Take out a text morph of the supplies-flap, embed it into your button, and proceed as above. The advantage of doing so is that you can change the text and the font directly. Cheers, Markus p.s. I actually found out about the first option only last week, after sending below mail. EToys for the constructivistic explorer: "Always get a new surprise feature from time to time..." ;-) On Mar 1, 2006, at 1:08 PM, Hübner, Uwe wrote: > Hi Squeakers. > > I wonder if I've missed something. > How can I create a 'Label' of a button? > (I think a 'button' is something I've drawn and > now tell it to act upon mouse-down, isn't it?) > If a Label means text embedded into a drawing, > how can I change that text? > > Sincerely, > > Uwe > > -----Original Message----- > From: [hidden email] > [mailto:[hidden email]]On Behalf Of Markus Gaelli > Sent: Friday, February 24, 2006 2:32 PM > To: [hidden email] > Subject: Re: [Squeakland] newbie(ish) question (buttons) > Importance: High > > > Hi Kelly, > >> >> Need a little help. I am trying to figure out how to use or (re-use >> buttons). I have a button to fire a script. >> eg I have a sketch and when you press the button it runs around the >> playfield. >> >> I want to be able to click the button a second time to stop the >> script. >> >> I have tried many things but just cannot quite get there. Any >> suggestions?? Thanks > > You could ask the label of your button, if it says: "run" then run > the sketch > _and_ change the label to "stop", and if it says "stop" vice versa. > > "What makes sense to the user, often makes sense to the developer > too..." ;-) > > Cheers, > > Markus > _______________________________________________ > Squeakland mailing list > [hidden email] > http://squeakland.org/mailman/listinfo/squeakland _______________________________________________ Squeakland mailing list [hidden email] http://squeakland.org/mailman/listinfo/squeakland |
Hi Uwe,
> thanks for the 'extended' answer. > Unfortunately I could not follow your description. > > I did the following: > > 1. I worked with Squeakland image 3.8-05 latest update: #531 > > 2. I drew an 'Ellipse' and filled it > (that should become my 'button') > > 3. The balloon of the 'color-pipette-halo' > says: 'Repaint'. After pressing it (without shift), I get: And then I can press the button "Button" on the bottom... Does that help? But believe me, the other way is simpler, tell your ellipse to "accept drops" using the red handle, then just grab a text morph from the supplies and embed it. Open a viewer on the text and drag out the "characters"-setter found in the basic category into your buttonDown script. Cheers, Markus > Shift-Click: Back in the paint tool. > Ctrl-Click: I get a menu (must be the same > for every halo) that lists: > > grab > copy to paste buffer > delete > . > . > . > debug > > But neither a button, nor an entry 'button'. > > Cheers, > Uwe > > -----Original Message----- > From: Markus Gaelli [mailto:[hidden email]] > Sent: Wednesday, March 01, 2006 1:32 PM > To: Hübner, Uwe > Cc: Squeakland > Subject: Re: Label of a button Was: RE: [Squeakland] newbie(ish) > question (buttons) > Importance: High > > > Hi Uwe, > > indeed, my mail was a bit short... ;-) > > Two ways of doing it: > > 1.) Assuming you are using an up-to-date squeakland-image click on > the color-pipette-halo of your morph (might be chift-click, depends > on the morph, haven't explored the differences yet) and then the > button labeled "button" on the bottom. ;-) > There you can add a label. You can set the text of the label by > opening a viewer on it. Go to the "text"-category and type in your > label in the characters setter. (It is a bit strange that one cannot > change the label in the dialog directly). From there you can also > drag put the label setter for reasons described in my last mail below. > > 2.) Take out a text morph of the supplies-flap, embed it into your > button, and proceed as above. The advantage of doing so is that you > can change the text and the font directly. > > Cheers, > > Markus > > p.s. I actually found out about the first option only last week, > after sending below mail. > EToys for the constructivistic explorer: "Always get a new surprise > feature from time to time..." ;-) > > On Mar 1, 2006, at 1:08 PM, Hübner, Uwe wrote: > >> Hi Squeakers. >> >> I wonder if I've missed something. >> How can I create a 'Label' of a button? >> (I think a 'button' is something I've drawn and >> now tell it to act upon mouse-down, isn't it?) >> If a Label means text embedded into a drawing, >> how can I change that text? >> >> Sincerely, >> >> Uwe >> >> -----Original Message----- >> From: [hidden email] >> [mailto:[hidden email]]On Behalf Of Markus Gaelli >> Sent: Friday, February 24, 2006 2:32 PM >> To: [hidden email] >> Subject: Re: [Squeakland] newbie(ish) question (buttons) >> Importance: High >> >> >> Hi Kelly, >> >>> >>> Need a little help. I am trying to figure out how to use or (re-use >>> buttons). I have a button to fire a script. >>> eg I have a sketch and when you press the button it runs around the >>> playfield. >>> >>> I want to be able to click the button a second time to stop the >>> script. >>> >>> I have tried many things but just cannot quite get there. Any >>> suggestions?? Thanks >> >> You could ask the label of your button, if it says: "run" then run >> the sketch >> _and_ change the label to "stop", and if it says "stop" vice versa. >> >> "What makes sense to the user, often makes sense to the developer >> too..." ;-) >> >> Cheers, >> >> Markus >> _______________________________________________ >> Squeakland mailing list >> [hidden email] >> http://squeakland.org/mailman/listinfo/squeakland > _______________________________________________ Squeakland mailing list [hidden email] http://squeakland.org/mailman/listinfo/squeakland |
In reply to this post by "Hübner, Uwe"
No, it isn't.
We both just talked of differend things that have the same name! I 'painted' the ellipse. You 'drew' it out of the 'Supplies' flap. If I take it from the Supplies-flap, I can now follow your describtion exactly! Many thanks and sorry for the inconvenience! Kind regards, Uwe -----Original Message----- From: Markus Gaelli [mailto:[hidden email]] Sent: Thursday, March 02, 2006 1:29 PM To: Hübner, Uwe; Squeakland Subject: Re: Label of a button Was: RE: [Squeakland] newbie(ish) question (buttons) Importance: High Hi Uwe, > thanks for the 'extended' answer. > Unfortunately I could not follow your description. > > I did the following: > > 1. I worked with Squeakland image 3.8-05 latest update: #531 > > 2. I drew an 'Ellipse' and filled it > (that should become my 'button') > > 3. The balloon of the 'color-pipette-halo' > says: 'Repaint'. pipette in 3.8-05 #531 I get the following: _______________________________________________ Squeakland mailing list [hidden email] http://squeakland.org/mailman/listinfo/squeakland |
In reply to this post by Markus Gälli-3
As far as the balloon instructions...
I believe it may be one of you is using a "Squeak" image and the other "Squeakland". The paint/repaint balloon help/reaction is due to a preference -- the default in the Squeakland image is to "get a property sheet from halo". It might be you are using an image that does not have this preference selected. The other thing is a sketch will have a grey/repaint handle in the halo and an ellipse/non-sketch will have the bright pink/color picker/dropper handle. -- Kim At 1:28 PM +0100 3/2/06, Markus Gaelli wrote: >Hi Uwe, > >>thanks for the 'extended' answer. >>Unfortunately I could not follow your description. >> >>I did the following: >> >>1. I worked with Squeakland image 3.8-05 latest update: #531 >> >>2. I drew an 'Ellipse' and filled it >> (that should become my 'button') >> >>3. The balloon of the 'color-pipette-halo' >> says: 'Repaint'. >This is bizarre. If I don't press any key at all >and hover over the pipette in 3.8-05 #531 I get >the following: > > >Attachment converted: MAC OSX 10.4.5:pipette.png (PNGf/«IC») (001FEDBD) >After pressing it (without shift), I get: > > >Attachment converted: MAC OSX 10.4.5:propSheet.png (PNGf/«IC») (001FEDBE) >And then I can press the button "Button" on the bottom... > >Does that help? But believe me, the other way is >simpler, tell your ellipse to "accept drops" >using the red handle, then just grab a text >morph from the supplies and embed it. >Open a viewer on the text and drag out the >"characters"-setter found in the basic category >into your buttonDown script. > >Cheers, > >Markus > >> Shift-Click: Back in the paint tool. >> Ctrl-Click: I get a menu (must be the same >> for every halo) that lists: >> >> grab >> copy to paste buffer >> delete >> . >> . >> . >> debug >> >>But neither a button, nor an entry 'button'. >> >>Cheers, >>Uwe >> >>-----Original Message----- >>From: Markus Gaelli [mailto:[hidden email]] >>Sent: Wednesday, March 01, 2006 1:32 PM >>To: Hübner, Uwe >>Cc: Squeakland >>Subject: Re: Label of a button Was: RE: [Squeakland] newbie(ish) >>question (buttons) >>Importance: High >> >> >>Hi Uwe, >> >>indeed, my mail was a bit short... ;-) >> >>Two ways of doing it: >> >>1.) Assuming you are using an up-to-date squeakland-image click on >>the color-pipette-halo of your morph (might be chift-click, depends >>on the morph, haven't explored the differences yet) and then the >>button labeled "button" on the bottom. ;-) >>There you can add a label. You can set the text of the label by >>opening a viewer on it. Go to the "text"-category and type in your >>label in the characters setter. (It is a bit strange that one cannot >>change the label in the dialog directly). From there you can also >>drag put the label setter for reasons described in my last mail below. >> >>2.) Take out a text morph of the supplies-flap, embed it into your >>button, and proceed as above. The advantage of doing so is that you >>can change the text and the font directly. >> >>Cheers, >> >>Markus >> >>p.s. I actually found out about the first option only last week, >>after sending below mail. >>EToys for the constructivistic explorer: "Always get a new surprise >>feature from time to time..." ;-) >> >>On Mar 1, 2006, at 1:08 PM, Hübner, Uwe wrote: >> >>>Hi Squeakers. >>> >>>I wonder if I've missed something. >>>How can I create a 'Label' of a button? >>>(I think a 'button' is something I've drawn and >>> now tell it to act upon mouse-down, isn't it?) >>>If a Label means text embedded into a drawing, >>>how can I change that text? >>> >>>Sincerely, >>> >>>Uwe >>> >>>-----Original Message----- >>>From: [hidden email] >>>[mailto:[hidden email]]On Behalf Of Markus Gaelli >>>Sent: Friday, February 24, 2006 2:32 PM >>>To: [hidden email] >>>Subject: Re: [Squeakland] newbie(ish) question (buttons) >>>Importance: High >>> >>> >>>Hi Kelly, >>> >>>> >>>>Need a little help. I am trying to figure out how to use or (re-use >>>>buttons). I have a button to fire a script. >>>>eg I have a sketch and when you press the button it runs around the >>>>playfield. >>>> >>>>I want to be able to click the button a second time to stop the >>>>script. >>>> >>>>I have tried many things but just cannot quite get there. Any >>>>suggestions?? Thanks >>> >>>You could ask the label of your button, if it says: "run" then run >>>the sketch >>>_and_ change the label to "stop", and if it says "stop" vice versa. >>> >>>"What makes sense to the user, often makes sense to the developer >>>too..." ;-) >>> >>>Cheers, >>> >>>Markus >>>_______________________________________________ >>>Squeakland mailing list >>>[hidden email] >>>http://squeakland.org/mailman/listinfo/squeakland >> > > > >_______________________________________________ >Squeakland mailing list >[hidden email] >http://squeakland.org/mailman/listinfo/squeakland _______________________________________________ Squeakland mailing list [hidden email] http://squeakland.org/mailman/listinfo/squeakland |
In reply to this post by "Hübner, Uwe"
On Thu, 2 Mar 2006 13:28:44 +0100 Markus Gaelli <[hidden email]> wrote:
>Hi Uwe, > >> thanks for the 'extended' answer. >> Unfortunately I could not follow your description. >> >> I did the following: >> >> 1. I worked with Squeakland image 3.8-05 latest update: #531 >> >> 2. I drew an 'Ellipse' and filled it >> (that should become my 'button') >> >> 3. The balloon of the 'color-pipette-halo' >> says: 'Repaint'. >This is bizarre. If I don't press any key at all and hover over the >pipette in 3.8-05 #531 I get the following: Sounds like Uwe actually drew an ellipse with the painting tools while Markus used an EllipseMorph. For Uwe's method, there is a Repaint (meaning painting tools) halo and another halo which may be on the left or right, may be magenta or light-gray and may say Property sheet or Change color - all depending on halo preferences set in the preferences tool. Cheers, Bob _______________________________________________ Squeakland mailing list [hidden email] http://squeakland.org/mailman/listinfo/squeakland |
In reply to this post by "Hübner, Uwe"
Uwe,
If you hold down the shift button while selecting the change color button on the halo you will get the options that Marcus has been talking about.
Regards
Kelly
On 02/03/06, Hübner, Uwe <[hidden email]> wrote:
No, it isn't. _______________________________________________ Squeakland mailing list [hidden email] http://squeakland.org/mailman/listinfo/squeakland |
Free forum by Nabble | Edit this page |