/* GUIBEGIN WINDOW , 31, 131, 227, 63, POPUP|CAPTION|SYSMENU|MINBOX|MAXBOX|THICK, , CTLCOLOREDIT example FONT 8, 400, MS Shell Dlg ENTRY 41, 11, 64, 12, H_AUTO|BORDER|TABSTOP, , Entry1 ENTRY 150, 11, 64, 12, H_AUTO|BORDER|TABSTOP, , Entry2 ENTRY 41, 29, 64, 12, H_AUTO|BORDER|TABSTOP, , Entry3 ENTRY 150, 30, 64, 12, H_AUTO|BORDER|TABSTOP, , Entry4 TEXT 14, 13, 26, 8, GROUP, , , , Entry 1 TEXT 122, 13, 26, 8, GROUP, , , , Entry 2 TEXT 122, 32, 26, 8, GROUP, , , , Entry 4 TEXT 13, 31, 26, 8, GROUP, , , , Entry 3 DEND GUIEND */ /* * An example of handling the CTLCOLOREDIT event of a * REXX GUI window to set the color of ENTRY controls. * * In this example, we'll change the color of ENTRY controls in * window. This will be almost the same as colors.rex (which * handled the CTLCOLORSTATIC event) but here we're going to do * one other thing. Instead of changing the colors of all entry * boxes, we're going to change only one specific entry box. To * do this, you'll see how you can use the window handle arg to * our WM_CTLCOLOREDIT to determine the correct control. */ OPTIONS "C_CALL LABELCHECK WINFUNC NOSOURCE" LIBRARY rexxgui DO /* Register GetStockObject so we can grab one of the preset brushes for drawing text. */ FUNCDEF("GetStockObject", "void, 32u", "gdi32") /* Register SetBkColor so we can change the background color for text. */ FUNCDEF("SetBkColor", "32u, void, 32u", "gdi32") /* Register SetTextColor so we can change the foreground color for text. */ FUNCDEF("SetTextColor", "32u, void, 32u", "gdi32") CATCH FAILURE CONDITION("M") RETURN END /* Initialize the contents of our ENTRY controls. */ Entry1 = "something" Entry2 = "something" Entry3 = "something" Entry4 = "something" GuiErr = "SYNTAX" GuiHeading = 1 GuiCreateWindow('NORMAL') /* We want to change the color of only "Entry2". Let's * get its window handle by calling GuiQuery(). */ Entry2Handle = GuiInfo("HANDLE", "Entry2") Again: DO FOREVER GuiGetMsg() CATCH SYNTAX CONDITION('M') SIGNAL Again CATCH HALT FINALLY GuiDestroyWindow() END RETURN /* ================== WM_CTLCOLOREDIT ================== * This handles the CTLCOLOREDIT event for my window. * * This event happens when REXX GUI wants us to return * a "brush" used for drawing ENTRY controls. * * ARG(1) is our device context handle. * ARG(2) is the handle to the entry control (window). * * CTLCOLOREDIT works the same as CTLCOLORSTATIC, so * see the comments in colors.rex. */ WM_CTLCOLOREDIT: PROCEDURE EXPOSE Entry2Handle /* Is this the second entry? If so, return a new * color. If not, then do the default handling instead. */ IF Entry2Handle = ARG(2) THEN DO /* Now return the new color. */ SetTextColor(ARG(1), 255 * 256) SetBkColor(ARG(1), 255) RETURN GetStockObject(5) END /* It is some other ENTRY. Let Rexx Gui process this event. */ RETURN