Using Windows and Buttons in MSW
Logo
MSW Logo provides access to the full set of Windows Graphical User Interface
(GUI) routines. The procedure below demonstrates how to set up a window
with buttons to control sounds ...
When each of the buttons is clicked a different sound plays.
to buttons
; (C) 1999 jfuller EDUCATIONAL
; A procedure written by J P Fuller 1999 to
; demonstrate how use 'buttons' to control procedures
; The screen window in a SVGA system set to 800 x 600 pixels
; is 400 wide by 300 high
windowcreate "main "mywindow "Buttons 10 0 300 150 []
; Creates a sub-window called "Buttons"
; NOTE: You can remove this window on closing with a
; windodelete "mywindow command.
; NOTE - The "[]" is a left/right square bracket. It is essential!"
groupboxcreate "mywindow [ box] 10 10 275 110
; Draws the rectangle around the main window
; NOTE: Screen co-ordinates are: x1, y1, x2, y2 (ie Horiz, Vert)
buttoncreate "mywindow "A "1 25 25 10 10 [sound [1000
200]]
buttoncreate "mywindow "B "2 25 50 10 10 [sound [500 200]]
buttoncreate "mywindow "C "3 25 75 10 10 [sound [250 200]]
buttoncreate "mywindow "D "4 25 100 10 10 [sound [125 200]]
; The lines above set up the four individual control buttons.
; The letters "A", "B", "C" and "D"
are needed for naming purposes,
; but the names do not appear on the screen.
; The numbers "1", "2", "3" and "4"
appear as button 'labels'.
buttoncreate "mywindow "Close [Close Window] 225 125 60 10
[windowdelete "mywindow]
; This line closes the sub-window opened in the first line.
staticcreate "mywindow "W [Sound 1] 45 25 80 10
staticcreate "mywindow "X [Sound 2] 45 50 80 10
staticcreate "mywindow "Y [Sound 3] 45 75 80 10
staticcreate "mywindow "Z [Sound 4] 45 100 80 10
; These lines create sub-windows in mywindow and
; write the text contained between the square brackets.
; NOTE: Make sure the sub-windows are large enough to
; hold all the text, or it will simply disappear!
end
NOTE: Try changing the values in the brackets
to make sure you understand how it all works.
<- Back -Menu- Next
->