"SfR Fresh" - the SfR Freeware/Shareware Archive

Member "usr/xb-6.2.3/demo/aeasy.x" of archive xbasic-6.2.3-linux-i386.tar.gz:


As a special service "SfR Fresh" has tried to format the requested source page into HTML format using source code syntax highlighting with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.
    1 '
    2 '
    3 ' ####################
    4 ' #####  PROLOG  #####
    5 ' ####################
    6 '
    7 PROGRAM	"aeasy"
    8 VERSION	"0.0002"
    9 '
   10 IMPORT	"xgr"
   11 IMPORT	"xui"
   12 '
   13 DECLARE  FUNCTION  EasyGui ()
   14 '
   15 '
   16 ' ########################
   17 ' #####  EasyGui ()  #####
   18 ' ########################
   19 '
   20 FUNCTION  EasyGui ()
   21 	$SwitchWindow = 1
   22 	$EasyGuiWindow = 2
   23 	$NanoWayWindow = 3
   24 '
   25 ' create and configure the $SwitchWindow
   26 '
   27 	XuiCreateWindow      (@grid, @"XuiPushButton", 100, 300, 200, 100, 0, "")
   28 	XuiSendStringMessage ( grid, @"SetCallback", grid, &XuiQueueCallbacks(), -1, -1, $SwitchWindow, -1)
   29 	XuiSendStringMessage ( grid, @"SetColor", $$BrightGreen, $$Yellow, -1, -1, 0, 0)
   30 	XuiSendStringMessage ( grid, @"SetTextString", 0, 0, 0, 0, 0, @"Press Here\nTo Switch Windows")
   31 	XuiSendStringMessage ( grid, @"SetFont", 320, 600, 400, 0, 0, @"Serif")
   32 	XuiSendStringMessage ( grid, @"DisplayWindow", 0, 0, 0, 0, 0, 0)
   33 	switch = grid
   34 '
   35 ' create and configure the $EasyGuiWindow
   36 '
   37 	XuiCreateWindow      (@grid, @"XuiCheckBox", 308, 300, 200, 100, 0, "")
   38 	XuiSendStringMessage ( grid, @"SetCallback", grid, &XuiQueueCallbacks(), -1, -1, $EasyGuiWindow, -1)
   39 	XuiSendStringMessage ( grid, @"SetColor", $$BrightCyan, $$Yellow, -1, -1, 0, 0)
   40 	XuiSendStringMessage ( grid, @"SetTextString", 0, 0, 0, 0, 0, @"EasyGui Is\n!!!  So Damn Easy  !!!")
   41 	XuiSendStringMessage ( grid, @"SetFont", 320, 600, 400, 0, 0, @"Serif")
   42 	XuiSendStringMessage ( grid, @"SetValue", -1, 0, 0, 0, 0, 0)
   43 	XuiSendStringMessage ( grid, @"DisplayWindow", 0, 0, 0, 0, 0, 0)
   44 	easy = grid
   45 '
   46 ' create and configure the $NanoWayWindow
   47 '
   48 	XuiCreateWindow      (@grid, @"XuiDialog3B", 100, 427, 408, 200, 0, "")
   49 	XuiSendStringMessage ( grid, @"SetCallback", grid, &XuiQueueCallbacks(), -1, -1, $NanoWayWindow, -1)
   50 	XuiSendStringMessage ( grid, @"SetColor", $$LightBlue, $$Yellow, -1, -1, 1, 0)
   51 	XuiSendStringMessage ( grid, @"SetColorExtra", -1, -1, $$Black, $$Yellow, 1, 0)
   52 	XuiSendStringMessage ( grid, @"SetColor", $$BrightGreen, -1, -1, -1, 3, 0)
   53 	XuiSendStringMessage ( grid, @"SetColor", $$BrightCyan, -1, -1, -1, 4, 0)
   54 	XuiSendStringMessage ( grid, @"SetColor", $$BrightMagenta, -1, -1, -1, 5, 0)
   55 	XuiSendStringMessage ( grid, @"SetFocusColor", $$BrightGreen, -1, -1, -1, 3, 0)
   56 	XuiSendStringMessage ( grid, @"SetFocusColor", $$BrightCyan, -1, -1, -1, 4, 0)
   57 	XuiSendStringMessage ( grid, @"SetFocusColor", $$BrightMagenta, -1, -1, -1, 5, 0)
   58 	XuiSendStringMessage ( grid, @"SetFont", 480, 600, 400, 0, 1, @"Serif")
   59 	XuiSendStringMessage ( grid, @"SetTextString", 0, 0, 0, 0, 1, @"Easy Gui\nFrom NanoWay")
   60 	XuiSendStringMessage ( grid, @"SetTextString", 0, 0, 0, 0, 2, @"Demo By Steve Fraud")
   61 	XuiSendStringMessage ( grid, @"SetTextString", 0, 0, 0, 0, 5, @"Quit")
   62 	XuiSendStringMessage ( grid, @"SetTexture", $$TextureShadow, -1, -1, -1, 1, 0)
   63 	nanoway = grid
   64 	visible = easy
   65 '
   66 ' 1: Wait for one message in XgrProcessMessages(1) then process it.
   67 ' 2: Call XuiGetNextCallback() to check for a pending callback message.
   68 ' 3: If a callback message is ready and returned by XuiGetNextCallback(),
   69 '    then go to a subroutine designed to handle callbacks from the
   70 '    window that caused the callback.
   71 ' 4: When the callback is processed, loop to continue processing
   72 '
   73 ' To put this loop in a function that a running program can call
   74 ' periodically to process user actions, just change the argument
   75 ' to XgrProcessMessages() to -2 and change the last line to
   76 ' "LOOP WHILE ready".
   77 '
   78 	DO
   79 		XgrProcessMessages (1)
   80 		grid = 0 : message = 0 : v0 = 0 : v1 = 0 : v2 = 0 : v3 = 0 : rr0 = 0 : r1$ = ""
   81 		ready = XuiGetNextCallback (@grid, @message$, @v0, @v1, @v2, @v3, @rr0, @r1$)
   82 		r0 = rr0 AND 0xFFFF
   83 		wintag = rr0 >> 16
   84 		IF ready THEN
   85 			SELECT CASE wintag
   86 				CASE $SwitchWindow		: GOSUB SwitchWindow
   87 				CASE $EasyGuiWindow		: GOSUB EasyGuiWindow
   88 				CASE $NanoWayWindow		: GOSUB NanoWayWindow
   89 				CASE ELSE							: PRINT "You're pulling my leg, right?"
   90 			END SELECT
   91 		END IF
   92 	LOOP
   93 '
   94 '
   95 ' *****  SwitchWindow  *****
   96 '
   97 SUB SwitchWindow
   98 	SELECT CASE visible
   99 		CASE easy			: XuiSendStringMessage (easy, @"HideWindow", 0, 0, 0, 0, 0, 0)
  100 										XuiSendStringMessage (nanoway, @"DisplayWindow", 0, 0, 0, 0, 0, 0)
  101 										visible = nanoway
  102 		CASE nanoway	: XuiSendStringMessage (nanoway, @"HideWindow", 0, 0, 0, 0, 0, 0)
  103 										XuiSendStringMessage (easy, @"DisplayWindow", 0, 0, 0, 0, 0, 0)
  104 										visible = easy
  105 		CASE ELSE			: PRINT "Programmer Is BrainDamaged"
  106 	END SELECT
  107 END SUB
  108 '
  109 '
  110 ' *****  EasyGuiWindow  *****
  111 '
  112 SUB EasyGuiWindow
  113 	XuiSendStringMessage (grid, @"GetValue", @value, 0, 0, 0, r0, 0)
  114 	IF value THEN
  115 		string$ = "EasyGui\xAE Is\n!!!  So Damn Easy  !!!"
  116 	ELSE
  117 		string$ = "EasyGui\x99 Is\n!!!  So Damn Easy  !!!\n\xAB\xAB\xAB  NOT  \xBB\xBB\xBB"
  118 	END IF
  119 	XuiSendStringMessage (grid, @"SetTextString", 0, 0, 0, 0, r0, @string$)
  120 	XuiSendStringMessage (grid, @"Redraw", 0, 0, 0, 0, 0, 0)
  121 END SUB
  122 '
  123 '
  124 ' *****  NanoWayWindow  *****
  125 '
  126 SUB NanoWayWindow
  127 	XuiSendStringMessage (grid, "GetTextString", 0, 0, 0, 0, r0, @string$)
  128 	XuiSendStringMessage (grid, "GetTextString", 0, 0, 0, 0, 2, @text$)
  129 	PRINT "$NanoWayWindow : "; LJUST$(r1$,8); " : "; RJUST$(message$,12); " : "; CJUST$(string$,21); " : "; text$
  130 	IF (r0 = 5) THEN QUIT (0)
  131 END SUB
  132 END FUNCTION
  133 END PROGRAM