Guidance
指路人
g.yi.org
Guidance Forums / Reginald Rexx / View control

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

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. View control
#11647
Posted by: Michael S 2007-08-30 15:45:49
I want to use the View control for the first time and am hitting a problem/bug. Here's my test code

/*
GUIBEGIN


WINDOW , 0, 0, 507, 193, POPUP|CAPTION|SYSMENU|MINBOX|MAXBOX|THICK, , Trace results
	FONT 8, 400, MS Shell Dlg
	STATUS BOTTOM|GRIP, status_bar
	PUSH 389, 14, 50, 14, TABSTOP, , ok_button, , Fill view
	VIEW 13, 44, 473, 126, REPORT|SHARE|EDIT|BORDER, CLIENTEDGE, trace_view
DEND
GUIEND
*/

/* Load Rexx Gui functions. */
LIBRARY rexxgui
guierr = "SYNTAX"
guiheading = 1

guicreatewindow()
rc = post_create_window()
/* Now sync all the controls with their variables' values. */
guisetctlvalue()
guisetctlplacement(,,,,,,'NORMAL')

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
/*****************************************************************
 Allows you to manipulate the controls - something you CAN'T do 
 until the window has been created
*****************************************************************/
post_create_window:

DO i = 1 TO 4
	
	SELECT i
		WHEN 1 THEN
			DO 
				mycolumn.!width = 40  /* 1/3 of the VIEW control's width */
				mycolumn.!text = "Module/section"
				mycolumn.!state = "LEFT"
			END	
		WHEN 2 THEN 
			DO
				mycolumn.!width = 20  /* 1/3 of the VIEW control's width */
				mycolumn.!text = "Start"
				mycolumn.!state = "LEFT"
			END	
		WHEN 3 THEN 
			DO
				mycolumn.!width = 20  /* 1/3 of the VIEW control's width */
				mycolumn.!text = "End"	
				mycolumn.!state = "LEFT"		
			END	
		OTHERWISE 
			DO
				mycolumn.!width = 20
				mycolumn.!text = "Time taken (secs)"
				mycolumn.!state = "RIGHT"
			END	
	END
		
	mycolumn.!subitem = i
	guiaddctltext("trace_view", "MyColumn", 1)
END

RETURN 0
/*******************************************************************
 Let's check that we've got a value in both the program name and
 the starting time
*******************************************************************/ 
wm_click_ok_button:

trace_event_type.0 = 5
DO i = 1 TO 5
	trace_text.i = 'Trace_text 'i
	trace_event_type.i = 'Trace_event_type 'i
END

DO i = 1 TO trace_event_type.0
	myitem.!item = i	/* First item */
	myitem.!subitem = 1	/* Under the first column */
	myitem.!text = trace_text.i
	myitem.!subitem = 2	/* Under the second column */
	myitem.!text = trace_event_type.i
	guiaddctltext("trace_View", "MyItem")
END 

RETURN 0

Run the script, press the button - I don't see anything being added to the view control. I'm assuming I can do what I'm trying to ?

I'll carry on experimenting in the meantime
Message2. Found it
#11648
Posted by: Michael S 2007-08-30 15:50:48
The last DO block should have been (note the GuiAddCtlText for every cell in the view)

DO i = 1 TO trace_event_type.0
	myitem.!item = i	/* First item */
	myitem.!subitem = 1	/* Under the first column (ie, Name) */
	myitem.!text = trace_text.i
	guiaddctltext("trace_View", "MyItem")
	myitem.!subitem = 2	/* Under the first column (ie, Name) */
	myitem.!text = trace_event_type.i
	guiaddctltext("trace_View", "MyItem")
	myitem.!subitem = 3	/* Under the first column (ie, Name) */
	myitem.!text = trace_text.i
	guiaddctltext("trace_View", "MyItem")
	myitem.!subitem = 4	/* Under the first column (ie, Name) */
	myitem.!text = trace_event_type.i
	guiaddctltext("trace_View", "MyItem")
END
Message3. Jeff - can you update the View docs please ?
#11649
Posted by: Michael S 2007-08-30 15:58:59
Now that I'm going to start using it, I can see a possible need for creating the control dynamically. In the one situation, I might want a view with 2 columns with data, in the other with 4 columns.

Or is there a way of changing the number of columns and headers (dropping the view's control variables and recreating them ?)
Message4. Another question
#11652
Posted by: Michael S 2007-08-30 17:44:04
Is there an equivalent way of doing the following (for a listbox control)

listboxline(handle, 393, i - 1, myline)

so as to pick up the next item/line from a view control ?
Message5. Sort of a view
#11656
Posted by: Michael S 2007-08-30 19:10:38
Is this implemented yet ? My control is defined as

view 15, 96, 473, 126, report|share|edit|border, clientedge, trace_view

but clicking on the column header seems to make no difference
Message6.
#12352
Posted by: Jeff Glatt 2008-09-05 04:09:42
You can remove a ctl with GuiRemoveCtl, reassign your variables, and then recreate the control with GuiAddCtl.
Message7.
#12354
Posted by: Jeff Glatt 2008-09-05 05:59:44
Update to the latest REXX GUI.

Assume you've associated the REXX variable named "MyView" with your view control.

Add a handler for its COLUMNCLICK event. Your view control's variable will be set to the column number clicked upon. For example:
wm_columnclick_myview:
   /* Called when user clicks on a column header. The variable for our control is
     * set to which column was clicked upon.
     */
   guisay("User clicked upon column #" || myview)
   RETURN
Message8. Thanks - did the trick nicely
#12355
Posted by: Michael S 2008-09-05 14:31:12
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
¥738.00 ·
 
 
¥1,480.00 ·
 
 
¥397.00 ·
 
 
¥950.00 ·
 
 
¥264.00 ·
 
 
¥1,005.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0