Guidance
指路人
g.yi.org
Upload / Forum Attachment / Reginald Rexx Programming Language Compiler User Forum Attachments and Pictures / 12724-view_header_question.rex

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

  
/*
GUIBEGIN


WINDOW , 0, 0, 400, 200, POPUP|CAPTION|SYSMENU|MINBOX|MAXBOX|THICK, , My Window
	FONT 8, 400, MS Shell Dlg
	PUSH 9, 12, 40, 14, TABSTOP, , fill_view_button, , Fill view
	VIEW 9, 33, 365, 150, REPORT|SHARE|EDIT|BORDER, , data_view
	PUSH 57, 12, 56, 14, TABSTOP, , fill_again, , Fill view again
DEND
GUIEND
*/

/* Load Rexx Gui functions. */
LIBRARY rexxgui

/* Raise SYNTAX condition for any error in a Rexx Gui function call */
guierr = "SYNTAX"

/* Prepend the error message with the name of the Gui function that raised SYNTAX */
guiheading = 1

/* Here you may want to set GuiX, GuiY, GuiWidth, and GuiHeight variables from some
 * configuration file or saved registry key.
 */

/* Create our window, and activate/show it */
guicreatewindow('NORMAL')

/* Uncomment to check for function name conflicts. */
/* RxFuncQuery() */

again:
/* Do our event loop for our main window. */
DO FOREVER

	/* Wait for some event to happen. */
	guigetmsg()

	/* Determine who woke us up from GuiGetMsg. Note: If the user has closed
	 * our main window, then Reginald has raised SYNTAX with a "No open windows"
	 * error. That's because we don't have a handler for WM_DESTROY that calls
	 * GuiWake.
	 */

	/* Did some handler for our main window call GuiWake()? Or perhaps it is
	 * someone other than a window signaling us?
	 */
	IF EXISTS('GuiObject') == 0 THEN DO

		/* Perhaps one of our window event handlers below, or a control event
		 * handler for some control in our main window, has called GuiWake()
		 * to have us handle the event here. In that case, some signal should have
		 * been passed to GuiWake() in order to let us know who signaled us and
		 * why. The particulars of what signal your handlers choose to use is
		 * totally open to your own design of your layout scripts and your main script.
		 *
		 * But if GuiObject is DROP'ed and GuiSignal is also DROP'ed, then this is
		 * Reginald signaling us to do nothing here.
		 */
		IF EXISTS('GuiSignal') THEN DO

			/* One of our handlers below called GuiWake() to tell us to do something here. */

		END

	END

	/* Some Child Window Layout script called GuiWake() to wake us up. GuiObject has
	 * been set to the name of its object variable, and GuiSignal to whatever.
	 */
	ELSE DO

		/* If GuiSignal is DROP'ed, assume the child wants us to simply DROP its object. */
		IF EXISTS('GuiSignal') == 0 THEN DROP (guiobject)

		/* The child script wants something else. GuiSignal is telling us what. Do
		 * a SELECT on GuiObject name to determine which window sent the signal.
		 */
		ELSE SELECT guiobject

			/* Here you add a WHEN clause for each child object variable name. You
			 * must uppercase the name. Then look at GuiSignal and do... whatever.
			 */
			WHEN 0 THEN NOP


			OTHERWISE
		END /* SELECT GuiObject */

	END /* Some child script signaled us */

	/* Report any SYNTAX error. To continue our event loop, we signal
	 * back to "Again". Otherwise, our application would terminate.
	 */
	CATCH SYNTAX
			CONDITION()
			SIGNAL again

	CATCH HALT

	/* If you have any special cleanup to do, then you put it in this FINALLY. */

	/* Let's make sure that our main window is destroyed. We do that
	 * by calling GuiDestroyWindow.
	 *
	 * NOTE: It is safe to call GuiDestroyWindow even if our
	 * GuiCreateWindow never succeeded.
	 */
	FINALLY
		guidestroywindow()
END
RETURN

wm_click_fill_view_button:

myvar.0 = 4
myvar.1 = "Column_1"||'09'x||"Column_2"||'09'x||"Column_3"||'09'x||"Column_4"
myvar.2 = "Line 1,1"||'09'x||"Line 1,2"||'09'x||"Line 1,3"||'09'x||"Line 1,4"
myvar.3 = "Line 2,1"||'09'x||"Line 2,2"||'09'x||"Line 2,3"||'09'x||"Line 2,4"
myvar.4 = "Line 3,1"||'09'x||"Line 3,2"||'09'x||"Line 3,3"||'09'x||"Line 3,4"

rc = delete_all_data_lines()
rc = define_data_view_control(myvar.)

RETURN
/************************************************************
 Get rid of any existing view data 
************************************************************/
delete_all_data_lines:
guisendmsg("data_View", "GETITEMCOUNT")
count = guisignal
DO i = count TO 1 BY -1
	guisendmsg("data_View", "DELETEITEM", i)
END

/* HOW do I delete the headers as well ??????? 
	 If I have to delete the view control first, how do I do that 
	 AND then create a new copy ????? */

RETURN 0
/******************************************************************
 Define the column headers etc for the data view control
 Data will be column separated by a '09'x
******************************************************************/ 
define_data_view_control:

USE ARG data.

view_header = TRANSLATE(data.1,' ','09'x)
nr_cols = WORDS(view_header)

DO i = 1 TO nr_cols	
	mycolumn.!width = 20 
	mycolumn.!text = WORD(view_header,i)
	mycolumn.!subitem = i
	guiaddctltext("data_view", "MyColumn", 1)
END

DO row = 2 TO data.0
	temp = data.row
	myitem.!item = row - 1				/* Row number */	
	DO i = 1 TO nr_cols	
		PARSE VAR temp next_value '09'x temp
		myitem.!subitem = i				/* Column number */
		myitem.!text = next_value 		/* Cell content */
		guiaddctltext("data_View", "MyItem")
	END
END	

RETURN 0


wm_click_fill_again:
	RETURN
掌柜推荐
 
 
¥477.00 ·
 
 
¥918.00 ·
 
 
¥370.00 ·
 
 
¥271.00 ·
 
 
¥995.00 ·
 
 
¥1,580.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2009-02-26 14:43:50