Guidance
指路人
g.yi.org
Guidance Forums / Reginald Rexx / "Problem" with GuiSetCtlPlacement

Register 
新用户注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. "Problem" with GuiSetCtlPlacement
#13589
Posted by: Michael S 2012-04-22 14:42:18 Last edited by: Michael S 2012-04-22 14:48:46 (Total edited 1 time)
I've just replaced my old laptop (Windows XP) with a new one running 7. If it's relevant, I installed Reginald in c:\program files\ rather than the x86 directory (to be honest, I don't know what the difference is)

I'm having a problem with a script that has been working for years and hasn't been changed. I'm running it in RPC - here's the basic code. First, a script that will position the window in any one of the four corners

PROCEDURE EXPOSE guiwindow

ARG position, max_x, max_y, x_size, y_size

SELECT position
	WHEN 'TL' THEN
		DO
			SAY "About to do the guisetctlplacement"
			guisetctlplacement(,0,0)  /* Top left */
			SAY "After doing the guisetctlplacement"
		END	
	WHEN 'TR' THEN
		guisetctlplacement(,max_x - (x_size + 7),0) /* Top right */
	WHEN 'BL' THEN
		guisetctlplacement(,0,max_y - (y_size + 7)) /* Bottom left */
	WHEN 'BR' THEN
		guisetctlplacement(,max_x - (x_size + 7),max_y - (y_size + 7)) /* Bottom right */
	OTHERWISE
		NOP
END

SAY "About to return with 0 from place_window.rex"
RETURN 0

Here's the call to it from the base script (the commented code is me trying to figure out what's failing)

/*do
	catch error */
		SAY guisetctlplacement(, , , x_size, y_size, ,)
		SAY guigetctlplacement(, 'dummy1', 'dummy2', 'wdw_width', 'wdw_height')
		SAY place_window.rex('TL'/*, x_size, y_size, wdw_width, wdw_height*/)  
/*			CONDITION('M')
		return 0
end */

Here are the console results from running the code (note that I'm not seeing the text About to return with 0 from place_window.rex


About to do the guisetctlplacement
After doing the guisetctlplacement

I tried testing it using a new window script which works fine. Any suggestions as to how to track it down would be much appreciated.

As a couple of appends, I should mention that I replaced the call to place_window.rex with the string GuiSetCtlPlacement(,0,0) and it worked fine. I also check the value in GuiWindow on entry to place_window.rex and it seemed to contain a "reasonable" value. The actual error I'm getting is  the following
 
Line #589, err45.1: Data expected on RETURN instruction because routine "PLACE_WINDOW.REX" was used in an expression
Message2. Even stranger ....
#13590
Posted by: Michael S 2012-04-22 15:03:25
When I try and open the menu options for the main screen, I'm seeing the following attached image. The actual starter code in my script is as follows:-

/*
GUIBEGIN


WINDOW , 690, 12, 386, 133, POPUP|CAPTION|SYSMENU|MINBOX|MAXBOX|THICK, ONTOP, TUPP codes
	FONT 8, 400, MS Shell Dlg
	MENU
DEND

MENU
	HEADING &Options, options
		HEADING &TUPP times, tupp_times
			ITEM &Today, tupp_today
			ITEM This &week, tupp_week
			ITEM This &month, tupp_month
		<
		ITEM
		ITEM T&ransfer TUPP times, transfer_tupp
		ITEM &Add time away from work, add_missed_time
		ITEM
		ITEM Time &worked today, worked_today
		ITEM
		ITEM Time trace, time_trace, , GRAY
	<
	HEADING &TUPP codes
		ITEM &Add/Delete TUPP code, add_delete_tupp
		ITEM &Change TUPP name, change_tupp_name
	<
	HEADING &Help
		ITEM &Open help, help_open
	<
DEND
GUIEND
*/

and when I edit the menu options, all the values are shown correctly. It's only when I run it that the values aren't shown. (I've tried other window script with menu options - no problems)

Tupp_codes_01.png
Message3. I found the error (?)
#13591
Posted by: Michael S 2012-04-22 16:13:35
It was in a procedure in the script called WM_EXTRA: - this contained the code:-

/********************************************************
 This handles all events for our window which REXX
 GUI doesn't know about. REXX GUI doesn't know about
 any of the tray events, so any tray event causes
 Reginald to call this handler.
*******************************************************/
wm_extra:

/*  say  'Arguments are 'arg(1) arg(2) arg(3) */
arg_1 = ARG(1)
arg_2 = ARG(2)
arg_3 = ARG(3)
	
/* rc = wdwsay.rex("Arg 1 2 & 3 "arg(1) arg(2) arg(3))*/
/* Figure out what to do based on the message number */
SELECT 
	WHEN arg_1 = 13 THEN
		DO
			/* We're restarting or shutting down Windows (at home) 
		     Save the TUPP data first */
			rc = save_all_data('SHUT')
			RETURN ''
		END	
	WHEN arg_2 = 0 & arg_3 = 59 THEN
		DO
			/* We're logging off, restarting or shutting down Windows (at work) 
		     Save the TUPP data first */
			rc = save_all_data('SHUT')
			RETURN ''
		END				
	/* It our custom event we used for the tray? If so, the
		 message number = 50000 because that's what we chose.
		 
		 The OS causes this even when some activity happens
		 with our tray icon.
		 
		 ARG(1) is the ID number we used for the icon. In this
		 example, it was 10.
		 ARG(2) is the message number sent from the icon.
	*/
	WHEN arg_3 <> 50000 THEN 
		NOP						/* Nothing to do with the tray */
	WHEN arg_2 = 516 THEN
	 	DO
			/* WM_RBUTTONDOWN - they right-clicked the mouse button - reshow the window */
			guisetctlplacement(guiwindow,,,,,,'NORMAL')
		END	
	OTHERWISE
		/* For all other messages, we have no processing */
		NOP
END /* SELECT message number */

/* Don't let Rexx Gui process this event. */
RETURN ""
The last line return "" was the offender. Including the "" caused the menu options to be hidden, removing it, and they worked as expected
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Thu 2017-6-29  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0