/* 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