/* Custom mainline for macro */ call RXFuncAdd "VRLoadFuncs", "VROBJ", "VRLoadFuncs" call VRLoadFuncs _VREVersion = SubWord( VRVersion( "VRObj" ), 1, 1 ) if( _VREVersion < 2.14 )then do call VRMessage "", "This program requires VX-REXX version 2.1d to run.", "Error!" return 32000 end signal on SYNTAX name _VRESyntax signal _VREMain _VRESyntax: parse source . . _VRESourceSpec call VRMessage "", "Syntax error in" _VRESourceSpec "line" SIGL":" ErrorText(rc), "Error!" call VRFini exit 32000 _VREMain: /*:VRX Main */ /* Main */ Main: /* Process the arguments. Get the parent window. */ parse source . calledAs . parent = "" argCount = arg() argOff = 0 if( calledAs \= "COMMAND" )then do if argCount >= 1 then do parent = arg(1) argCount = argCount - 1 argOff = 1 end end; else do call VROptions 'ImplicitNames' call VROptions 'NoEchoQuit' end InitArgs.0 = argCount if( argCount > 0 )then do i = 1 to argCount InitArgs.i = arg( i + argOff ) end drop calledAs argCount argOff /* Load the windows */ call VRInit parse source . . spec _VREPrimaryWindowPath = , VRParseFileName( spec, "dpn" ) || ".VRW" _VREPrimaryWindow = , VRLoad( parent, _VREPrimaryWindowPath ) drop parent spec if( _VREPrimaryWindow == "" )then do call VRMessage "", "Cannot load window:" VRError(), , "Error!" _VREReturnValue = 32000 signal _VRELeaveMain end /* Process events */ call Init signal on halt do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) ) _VREEvent = VREvent() interpret _VREEvent end _VREHalt: _VREReturnValue = Fini() call VRDestroy _VREPrimaryWindow _VRELeaveMain: call VRFini exit _VREReturnValue VRLoadSecondary: __vrlsWait = abbrev( 'WAIT', translate(arg(2)), 1 ) if __vrlsWait then do call VRFlush end __vrlsHWnd = VRLoad( VRWindow(), VRWindowPath(), arg(1) ) if __vrlsHWnd = '' then signal __vrlsDone if __vrlsWait \= 1 then signal __vrlsDone call VRSet __vrlsHWnd, 'WindowMode', 'Modal' __vrlsTmp = __vrlsWindows.0 if( DataType(__vrlsTmp) \= 'NUM' ) then do __vrlsTmp = 1 end else do __vrlsTmp = __vrlsTmp + 1 end __vrlsWindows.__vrlsTmp = VRWindow( __vrlsHWnd ) __vrlsWindows.0 = __vrlsTmp do while( VRIsValidObject( VRWindow() ) = 1 ) __vrlsEvent = VREvent() interpret __vrlsEvent end __vrlsTmp = __vrlsWindows.0 __vrlsWindows.0 = __vrlsTmp - 1 call VRWindow __vrlsWindows.__vrlsTmp __vrlsHWnd = '' __vrlsDone: return __vrlsHWnd /*:VRX Fini */ Fini: window = VRWindow() call VRSet window, "Visible", 0 drop window return ResultString /*:VRX Halt */ Halt: signal _VREHalt return /*:VRX Init */ Init: ResultString = '' CALL VRSet 'WN_PROMPT', 'Caption', InitArgs.1 '-' InitArgs.2 SELECT WHEN TRANSLATE( InitArgs.2 ) == 'REGISTER' THEN DO CALL VRSet 'EF_CONTROL', 'HintText', 'The name of the control to register' END WHEN TRANSLATE( InitArgs.2 ) == 'DEREGISTER' THEN DO CALL VRSet 'EF_CONTROL', 'HintText', 'The name of the control to deregister' CALL VRSet 'DT_TIP', 'Visible', 0 CALL VRSet 'EF_TIP', 'Visible', 0 CALL VRSet 'CB_QUOTED', 'Visible', 0 END WHEN TRANSLATE( InitArgs.2 ) == 'SETTIPTEXT' THEN DO CALL VRSet 'EF_CONTROL', 'HintText', 'The name of the control to update' END WHEN TRANSLATE( InitArgs.2 ) == 'GETTIPTEXT' THEN DO CALL VRSet 'EF_CONTROL', 'HintText', 'The name of the control to query' CALL VRSet 'DT_TIP', 'Visible', 0 CALL VRSet 'EF_TIP', 'Visible', 0 CALL VRSet 'CB_QUOTED', 'Visible', 0 END OTHERWISE NOP END window = VRWindow() call VRMethod window, "CenterWindow" call VRSet window, "Visible", 1 call VRMethod window, "Activate" drop window return /*:VRX PB_CANCEL_Click */ PB_CANCEL_Click: ResultString = '' CALL Quit RETURN /*:VRX PB_OK_Click */ PB_OK_Click: cntl = VRGet('EF_CONTROL', 'Value') tip = VRGet('EF_TIP', 'Value') quot = VRGet('CB_QUOTED', 'Set') IF quot == 1 THEN tip = '"'tip'"' SELECT WHEN TRANSLATE( InitArgs.2 ) == 'REGISTER' THEN DO ResultString = 'ok = VRMethod( "'InitArgs.1'", "Register", "'cntl'",' tip ')' END WHEN TRANSLATE( InitArgs.2 ) == 'DEREGISTER' THEN DO ResultString = 'ok = VRMethod( "'InitArgs.1'", "Deregister", "'cntl'" )' END WHEN TRANSLATE( InitArgs.2 ) == 'SETTIPTEXT' THEN DO ResultString = 'ok = VRMethod( "'InitArgs.1'", "SetTipText", "'cntl'",' tip ')' END WHEN TRANSLATE( InitArgs.2 ) == 'GETTIPTEXT' THEN DO ResultString = 'tiptext = VRMethod( "'InitArgs.1'", "GetTipText", "'cntl'" )' END OTHERWISE ResultString = '' END CALL Quit RETURN /*:VRX Quit */ Quit: window = VRWindow() call VRSet window, "Shutdown", 1 drop window return /*:VRX WN_PROMPT_Close */ WN_PROMPT_Close: call Quit return