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

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

  
/*
GUIBEGIN
WINDOW , 108, 169, 192, 138, POPUP|CAPTION|SYSMENU|MINBOX|MAXBOX|THICK, , TREE edit example
	FONT 8, 400, MS Shell Dlg
	TREE 0, 0, 192, 138, BUTTONS|LINES|ROOT|EDIT, , MyTree, , MyTreeItems
DEND
GUIEND
*/

/* An example of allowing the user to edit some tree item's
 * label, and detecting this change.
 */

LIBRARY rexxgui
guierr = "SYNTAX"
guiheading = 1

/* Function 2 functions we need */
FUNCDEF("GetWindowTextLength", "32u, 32u", "user32")
FUNCDEF("GetWindowText", "32u, 32u, 32u, 32u", "user32")

/* Tree Structure */
mytreeitems.1 = 'Parent 1'
mytreeitems.2 = 'Parent 2'
mytreeitems.3 = 'Parent 3'
mytreeitems.1.1 = 'Child 1'
mytreeitems.1.2 = 'Child 2'
mytreeitems.1.2.1 = 'One more'

guicreatewindow('NORMAL')
again:
DO FOREVER
	guigetmsg()
	CATCH SYNTAX
		CONDITION()
		SIGNAL again
	CATCH HALT
	FINALLY
		guidestroywindow()
END
RETURN

/* Called when the user is entering a new label, and then
 * presses ENTER to finish.
 */
wm_endlabeledit_mytree:
	/* Any memory we allocate in this subroutine is
	 * automatically freed when we return
	 */
	OPTIONS "MEMPOINT"

	/* Get the selected tree item */
	guigetctlvalue('MyTree')

	/* Determine how much text the user entered */
	amount = getwindowtextlength(edithandle)

	/* Allocate a buffer to get the entered text. We MUST allocate room for 1 extra char */
	buffer = CONVERTDATA(0,"","char[" || amount + 1 || "]", "A")

	/* Get the entered text */
	getwindowtext(edithandle, buffer, amount + 1)

	/* Assign the text buffer to our "text" variable so we can SAY it*/
	CONVERTDATA(buffer, 'text', amount, '=')
	SAY mytree '=' text

	/* Return a 1 to let the text change, or nothing
	 * to cancel it
	 */
	RETURN 1

/* Called when the user double-clicks upon a tree label
 * to edit it.
 */
wm_beginlabeledit_mytree:
	/* Store the handle to the edit control that appears inside of the tree */
	edithandle = guitreeedit
	RETURN
掌柜推荐
 
 
¥900.00 ·
 
 
¥880.00 ·
 
 
¥497.00 ·
 
 
¥380.00 ·
 
 
¥980.00 ·
 
 
¥1,080.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2010-07-16 20:45:30