Documention for: oneliner-image-viewer.r Created by: vincentecuye on: 29-Jan-2013 Format: text/editable Downloaded on: 28-Mar-2024 oneliner-image-viewer.r Author: Vincent Ecuyer Date: 29-Jan-2013 ===Purpose A very small PNG/JPEG/BMP/GIF viewer. ===Usage 'do the script, copy/paste the code in a /View console, or use it as a parameter the /View executable in a command line or a MS-Windows shortcut. Clicking the "Load" box or a loaded picture opens a file requester, and if /View can load the selected picture the window will be resized to show it. ===Commented Code ; Opens a new window, and stores the face! in 'l for later usage. view l: layout [ ; Uses the full window surface origin 0x0 ; Labelled 100x100 box, which will serve as storage for pictures b: box "Load" [ ; Actions executed on a click. "error? try" is the same as "attempt" in ; later versions: in case of error, exits the function but don't crashe error? try [ ; requests a file and try to load it - 'i stores the image too for later access b/image: i: load first request-file ; if loading is a success, the text isn't needed anymore, so clears it b/text: "" ; resizes both the window ('l) and the box ('b) to the image ('i) size l/size: b/size: i/size ; updates the display show l ] ] ]