diff --git a/button.go b/button.go index 908936e..f3c5763 100644 --- a/button.go +++ b/button.go @@ -10,6 +10,7 @@ import ( type Button struct { // Clicked gets a message when the button is clicked. // You cannot change it once the Window containing the Button has been opened. + // If you do not respond to this signal, nothing will happen. Clicked chan struct{} lock sync.Mutex diff --git a/doc.go b/doc.go index 8a545fd..7487d5e 100644 --- a/doc.go +++ b/doc.go @@ -7,9 +7,9 @@ To use the library, place your main program code in another function and call Go Building GUIs is as simple as creating a Window, populating it with Controls, and then calling Open() on the Window. A Window only has one Control: you pack multiple Controls into a Window by arranging them in layouts (Layouts are also Controls). There are presently two Layouts, Stack and Grid, each with different semantics on sizing and placement. See their documentation. -Once a Window is open, you cannot make layout changes. +Once a Window is open, you cannot make layout or event channel changes. -Once your Window is open, you can begin to handle events. Handling events is simple: because all events are channels exposed as exported members of the Window and Control types, simply select on them. +Once your Window is open, you can begin to handle events. Handling events is simple: because all events are channels exposed as exported members of the Window and Control types, simply select on them. Event channels are initialized by default. However, before you Open a Window, you can freely reassign event channels, such that multiple events trigger the same channel, making event logic more compact. You may also choose not to handle events; events are sent asynchronously so the GUI loop is not initerrupted. Here is a simple, complete program that asks the user for their name and greets them after clicking a button. package main diff --git a/futureplans.md b/futureplans.md index 755139b..4dc1eb2 100644 --- a/futureplans.md +++ b/futureplans.md @@ -25,6 +25,7 @@ general list: - when adding menus: - provide automated About, Preferneces, and Quit that place these in the correct location - Quit should pulse AppQuit +- will probably want to bring back Event() as NewEvent() should that facility be necesary for menus, etc. problem points: - because the main event loop is not called if initialization fails, it is presently impossible for MsgBoxError() to work if UI initialization fails; this basically means we cannot allow initializiation to fail on Mac OS X if we want to be able to report UI init failures to the user with one (which would be desirable, maybe (would violate Windows HIG?)) diff --git a/init.go b/init.go index 9349713..8b9d9ba 100644 --- a/init.go +++ b/init.go @@ -17,7 +17,7 @@ func Go(main func()) error { // AppQuit is pulsed when the user decides to quit the program if their operating system provides a facility for quitting an entire application, rather than merely close all windows (for instance, Mac OS X via the Dock icon). // You should assign one of your Windows's Closing to this variable so the user choosing to quit the application is treated the same as closing that window. -// If you do not respond to this signal, nothing will happen. +// If you do not respond to this signal, nothing will happen; regardless of whether or not you respond to this signal, the application will not quit. // Do not merely check this channel alone; it is not guaranteed to be pulsed on all systems or in all conditions. var AppQuit chan struct{} diff --git a/todo.md b/todo.md index cbb1d12..6d92819 100644 --- a/todo.md +++ b/todo.md @@ -1,8 +1,6 @@ so I don't forget: - should Labels be selectable? - Message boxes should not show secondary text if none is specified. [TODO figure out what I meant by this] -- note that you can change event channels before opening the window; this allows unifying menus/toolbars/etc. - - will probably want to bring back Event() for this (but as NewEvent()) - add bounds checking to Area's sizing methods - describe thread-safety of Area.SetSize() - should all instances of -1 as error returns from Windows functions be changed to ^0 or does the uintptr() conversion handle sign extension? diff --git a/window.go b/window.go index c4ab16c..b182f7c 100644 --- a/window.go +++ b/window.go @@ -11,6 +11,7 @@ import ( type Window struct { // Closing gets a message when the user clicks the window's close button. // You cannot change it once the Window has been opened. + // If you do not respond to this signal, nothing will happen; regardless of whether you handle the signal or not, the window will not be closed. Closing chan struct{} lock sync.Mutex