Guidance
指路人
g.yi.org
Guidance Forums / Reginald Rexx / Push button "pushed" without being pushed

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

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Push button "pushed" without being pushed
#13307
Posted by: Michael S 2010-04-14 20:41:27
I realise it's a strange topic header, but I'll try and describe the scenario. We use a product called Beyond Compare here. It allows you to define an exit so you can "massage" your file before it's shown. I use a reginald exe to change the contents of my mainframe files from EBCDIC to ANSI.

One of the problems is for fixed length files. They are simply a looooooooong string of data - you have to know the length of each record. To that end, my reginald exe discovers the file is fixed length and shows a window that prompts the user for the record length. All well and good, until .... there seems to be some sort of memory/code problem (or whatever) left over after the first time I run it (which runs with no problem).

If I run  BC with my reginald exe exit too quickly consecutively, the reginald window is shown, but it's as if I'd pressed OK immediately (without my having done it).

Any suggestions ??

I include the relevant window code

/*
GUIBEGIN


WINDOW , 347, 108, 431, 41, POPUP|CAPTION|SYSMENU|THICK, , Specify the LRECL of the file
	FONT 8, 400, MS Shell Dlg
	TEXT 13, 16, 360, 8, GROUP, , filename_text, , Filename
	ENTRY 384, 14, 32, 12, H_AUTO|BORDER|TABSTOP, CLIENTEDGE, lrecl_entry
	PUSH 384, 29, 40, 9, DEFAULT|HIDE|TABSTOP, , ok_button, , OK
DEND
GUIEND
*/

general code TO check the file's record length etc

/*********************************************************

*********************************************************/
get_lrecl:
PROCEDURE EXPOSE lrecl_entry
ARG filename
LIBRARY rexxgui
guierr = "SYNTAX"
guiheading = 1
rc = pre_create_window()
IF rc <> 0 THEN 
	DO
		rc = wdwsay.rex('Return code from pre_create_window, rc = 'rc)
		RETURN 1
	END
guicreatewindow('NORMAL')
guiaddctltext('filename_text', filename)
lrecl_entry = "?"
again:
DO FOREVER
	guigetmsg()
	IF EXISTS('GuiObject') == 0 THEN DO
		IF EXISTS('GuiSignal') THEN DO
		END
	END
	CATCH SYNTAX
			CONDITION()
			SIGNAL again
	CATCH HALT
	FINALLY
		guidestroywindow()
END
RETURN 0
/***************************************************************
 Stuff we run through when the window has been created, but the
 controls have still NOT been created
***************************************************************/ 
pre_create_window:

PARSE SOURCE . . guisay_header
UPPER guisay_header
guisay_header = FILESPEC('N', guisay_header)
PARSE VAR guisay_header guisay_header '.' .
/* The next few lines create a value for the registry key that 
   is the same as the actual name of this rexx script, thus 
   ensuring that we can create unique names for each and every 
   script */   
registry_value = guisay_header
registry_key = "Software\SHBTOOLS\"||registry_value||'\'

user = TRANSLATE(USERID())
lrecl_entry = get_filename_lrecl()
RETURN 0
/************************************************************
 Get the LRECL for the filename if they've used it before
************************************************************/
get_filename_lrecl:
converted_filename = TRANSLATE(filename,"_","\")
temp = "filename_lrecl\"converted_filename
rc = read_write_registry.rex(temp, lrecl_entry, "R")
IF lrecl_entry = '' THEN
	/* Never been here - set to ? */	
	lrecl_entry = "?"

RETURN lrecl_entry
/************************************************************
 Save the LRECL for the current filename
************************************************************/
save_last_filename_lrecl:
temp = "filename_lrecl\"converted_filename
rc = read_write_registry.rex(temp, lrecl_entry, "W")
RETURN 0
/************************************************************
 Let's close down the window 
************************************************************/ 
/*
WM_CLOSE:
guisendmsg(,'POST CLOSE')
RETURN 
*/
/*************************************************************
 Clicked the hidden OK button
*************************************************************/ 
wm_click_ok_button:
rc = wdwsay.rex('OK button clicked') /* Second time round, this is shown WITHOUT my having done anything */
guigetctlvalue('lrecl_entry')
SELECT
	WHEN 0 = DATATYPE(lrecl_entry, "W") THEN
		rc = wdwsay.rex("Not a valid LRECL", "STOP|")
	WHEN lrecl_entry < 2 THEN
		rc = wdwsay.rex("Enter a valid LRECL (2 or more)", "STOP|")
	OTHERWISE
		DO
			rc = save_last_filename_lrecl()
			guisendmsg(,'POST CLOSE')
			/* GuiDestroyWindow()  */
		END	
END		

RETURN
Message2. Okay - here's a simple scenario that illustrates the point
#13308
Posted by: Michael S 2010-04-14 21:09:44
Run the the attached script. - when the guisay prompt comes up, press enter rather than clicking on the OK button - you'll see that the window after that simply flashes past. Now try the same thing but click on the OK button instead and the window will be shown and will wait for your input.

Is there some sort of guisendmsg I should be using to clear out some buffer ??
guisay_problem.rex
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
¥860.00 ·
 
 
¥900.00 ·
 
 
¥810.00 ·
 
 
¥317.00 ·
 
 
¥1,370.00 ·
 
 
¥660.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0