Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Q&D button maker

From: swhite::ci::bloomington::mn::us at: 3-Mar-2006 17:22

I suppose everybody but me knew this, but I just figured it out, and I didn't find anything like in the library while I was figuring it out, so I thought I would mention it. The application is a web-browser-based CGI program I am writing in COBOL. I wanted some buttons to put on a web page just because it would look better than just a highlighted text link. I don't have access to anything like Photoshop to make buttons. The application is on a unix computer on our internal network. I work at a Windows workstation on which I have installed REBOL. This script works because in REBOL everything, code, data, graphical things on the screen, are referred to by words. I see now the beauty of that idea. I wrote a script that displays some buttons. I assigned a word to each button (identified each button by a variable name, or however you want to say it). The word that identifies a button "contains" all the information about the button. The function assigned to a button can identify its own button by the button's word (its name). It passes that button (converted to an image) to another function that saves the button to a "png" file and ftp's the graphic over to the server where I am writing the CGI program. I modify my "button library" script so the buttons look like I want them to look, then I run the script. I click on each button and a graphic for each button magically appears over on the unix computer. This is so cool. The script follows, with the user name, password, and directory nodes replaced with generic place-holder values. *--------------- REBOL [ ] ;; [----------------------------------------------------------------] ;; [ These are the buttons for the temporary reservation program ] ;; [ for Park and Rec. ] ;; [----------------------------------------------------------------] SAVE-SITE: "ftp://user:password-" SAVE-BUTTON: func [ BUTTON-FILENAME [file!] BUTTON-IMAGE [image!] /local SAVE-FTP-LOC ] [ save/png BUTTON-FILENAME BUTTON-IMAGE SAVE-FTP-LOC: copy "" SAVE-FTP-LOC: to-url join SAVE-SITE [to-string BUTTON-FILENAME] write/binary SAVE-FTP-LOC read/binary BUTTON-FILENAME delete BUTTON-FILENAME ] view layout [ B01: button 260x55 "Add a new reservation/invoice" font [size: 14] [SAVE-BUTTON %btnresadd.png to-image B01] B02: button 260x55 "Modify/print an invoice" font [size: 14] [SAVE-BUTTON %btnresmod.png to-image B02] B03: button 260x55 "Display one day at a facility" font [size: 14] [SAVE-BUTTON %btnresprt.png to-image B03] B04: button 260x55 "Display one month at a facility" font [size: 14] [SAVE-BUTTON %btnresmth.png to-image B04] ] Steven White City of Bloomington 1800 W Old Shakopee Rd Bloomington MN 55431-3096 USA 952-563-4882 (voice) 952-563-4672 (fax)