Olga Tuzova wrote: > > Yes, I know that, but I have a bad habit to spoil library > procedures. > No problem, just making sure you knew. > > George, would you please tell me how to work with scrollbars. The > problem is the following. > > I'd like to choose some values with the help of scrollbars and THEN > use these values in the program. For example, I'd like to change this > way the position of the -1 Turtle. The program should wait for the > process of choosing to be completed. How it could be done? > Your "main" program should just bring up the "main" Window. Add a button to that same window that runs the orginal "core" program (Label it Go). This is what I mean by letting the user "drive" the program rather than let the program "drive" the user. It's a very different way to think and it's harder for folks that are used to the program driving the user to break old ways of thinking. Here is an example doing it each way. ********************** Letting Program Drive ******************** to main pr [How Many] make "many rl squares :many end to squares :many cs repeat :many [repeat 4 [fd 100 rt 90] rt 360/:many] end ********************** Letting User Drive ******************** to main windowcreate "main "mywindow "Squares 0 0 100 100 [] staticcreate "mywindow "mystatic "0 75 25 25 25 scrollbarcreate "mywindow "myscroll 25 25 50 25 [staticupdate "mystatic scrollbarget "myscroll] scrollbarset "myscroll 0 360 72 buttoncreate "mywindow "mybutton1 "Go 25 50 25 25 [squares scrollbarget "myscroll] buttoncreate "mywindow "mybutton2 "End 50 50 25 25 [windowdelete "mywindow] end to squares :many cs repeat :many [repeat 4 [fd 100 rt 90] rt 360/:many] end ******************** Same thing Commented ******************** to main ; Create a window at [0, 0] of size 100x100 windowcreate "main "mywindow "Squares 0 0 100 100 [] ; Add a "Static Text" to feedback to the user what the scrollbar is set to staticcreate "mywindow "mystatic "0 75 25 25 25 ; Create the scrollbar. When the user adjusts it, update the static text with it's value scrollbarcreate "mywindow "myscroll 25 25 50 25 [staticupdate "mystatic scrollbarget "myscroll] ; Initialize the range and current value of the scrollbar scrollbarset "myscroll 0 360 72 ; Add button to fire off "squares". Pass to it, the current value of the scrollbar buttoncreate "mywindow "mybutton1 "Go 25 50 25 25 [squares scrollbarget "myscroll] ; Add button to delete the window (which will delete all the controls as well) buttoncreate "mywindow "mybutton2 "End 50 50 25 25 [windowdelete "mywindow] end > ------------------------------------------------------ > windowcreate "main "mywindow "mytitle 0 0 100 100 [] > scrollbarcreate "mywindow "myscroll 25 25 50 25 [setheading > scrollbarget "myscroll] > scrollbarset "myscroll 0 360 0 > <try moving scrollbar and notice what happens to the turtle> > windowdelete "mywindow > ----------------------------------- > These lines are taken from the Help. Everything is clear here, except > the thing I'm asking about. > > Thank you, > Olga. -- =============================================================== George Mills email: mills@softronix.com http://www.softronix.com The www page contains some very powerful educational software. Our single most important investment is our kids. --------------------------------------------------------------- Please post messages to the Logo forum to logo-l@gsn.org. Mail questions about the list administration to logofdn@gsn.org. To unsubscribe send unsubscribe logo-l to majordomo@gsn.org.
Global SchoolNet Foundation -
Linking Kids Around the World!
Copyright GSN - All Rights Reserved
- Comments
& Questions
Visit GSN's
Global
Schoolhouse for more exciting learning resources!
Search our Site
-
Home