Guidance
指路人
g.yi.org
Software / Reginald / Examples / htmlstr.rex

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
/* This creates a Main Window containing an HTML Group with HTML strings.
 */

ADDRESS null

/* Trap HALT and SYNTAX in any scripts we call which don't
 * trap HALT or SYNTAX themselves.
 */
OPTIONS 'TRAP'

/* Trap SYNTAX/ERROR/HALT, and ask for ERROR raising. Disable
 * ERROR raising for RXMSG(). We'll test for errors in our
 * loop
 */
SIGNAL ON HALT
SIGNAL ON SYNTAX
SIGNAL ON ERROR
CALL RXERR('ERROR|DISPLAY', '~!MSG')




/* ================ Create "HTML display" Window =============== */
/* Default size and position. WindowID = 'RX' */
rx = ''

/* First Group is HTML */
rxtype.1 = 'HTML'

/* We're using HTML strings, not URL nor HTML filenames, and we want
 * app: events reported to us.
 */
rxflags.1 = 'STRING|NOBORDER|REPORT'

/* Labels for each HTML, and Groupbox */
rxlabel.1 = '|'

/* Variable name where the HTML strings are stored */
rxval.1 = 'TEXT'

/* RXINFO not needed */

/* ControlsPerLine, X Position, Y Position, Width, Height (ie, NumOfLines) */
rxpos.1 = '1 10 20 400 10'

/* The HTML strings */
text.1 = '<B>This is a test.</B><P><A HREF="str:1">Click here to cause event 1.</A><P><A HREF="str:2">Click here to cause event 2.</A>'

/* Specify NOCLOSE (since we'll do the closing ourselves), but not
 * RESULT so that we don't siphon the ENTER key from the HTML
 * control.
 */
CALL RXCREATE('Rx', 1, 'HTML display', 'NOCLOSE|SETVAL')
DO FOREVER

   /* Do user interaction */
   CALL RXMSG()

   /* CLOSE BOX? */
   IF rxid == '' THEN SIGNAL ERROR

   /* Display another HTML string. Which one depends upon event # */
   IF rxval.1 == '1' THEN CALL RXSET(, 'VALUE', 'This is the page for event 1.<P><TABLE BORDER=2 CELLPADDING=10><TR><TD>One</TD><TD>Two</TD></TR><TR><TD>Three</TD><TD>Four</TD></TR></TABLE><P><A HREF="str:3">Click here to go back to home page.</A>', 1, 1)
   ELSE IF rxval.1 == '2' THEN CALL RXSET(, 'VALUE', 'This is the page for event 2.<P><A HREF="str:3">Click here to go back to home page.</A>', 1, 1)
   ELSE CALL RXSET(, 'VALUE', text.1, 1, 1)

END





/* ==================== Error Handling ====================== */
syntax:
    /* Reginald's CONDITION('M') makes reporting SYNTAX easy. If using some
     * other interpreter, then you'll have to do things the hard way.
     */
    CALL CONDITION('M')
    /* CALL RXSAY(CONDITION('D') || '0D0A0D0A'X || SOURCELINE(SIGL),,'Error '||CONDITION('E')||' at line '||SIGL) */

halt:
error:
    /* NOTE: CONDITION('D') fetches error message. CONDITION('E') fetches the
     * error number. SIGL is the line number where the error occurred.
     * Rexx Dialog has already displayed a message since we specified DISPLAY
     * option.
     */
    CALL RXMSG(,'END')
    EXIT
掌柜推荐
 
 
¥288.00 ·
 
 
¥908.00 ·
 
 
¥289.00 ·
 
 
¥1,280.00 ·
 
 
¥1,360.00 ·
 
 
¥890.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-18 23:35:06