Guidance
指路人
g.yi.org
Guidance Forums / Reginald Rexx / Setting status bar contents from a called script

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

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Setting status bar contents from a called script
#13239
Posted by: Michael S 2010-03-09 16:32:16 Last edited by: Michael S 2010-03-09 16:33:24 (Total edited 2 times)
Assume I have a script A (a GUI script) that calls B. In A I do a GUIINFO to get the handle for the status bar control. I then call B where I want B to be able to write data to A's status bar. I call B with the following:-

PROCEDURE EXPOSE guiwindow status_bar_handle
etc etc

and further down in B I have

DO
	status_bar = 'Default DB2 system is 'selected_database
	guisetctlvalue(status_bar_handle, 1) 
	CATCH SYNTAX
		NOP
END

but this doesn't seem to work. Do I have to have the setting of the status bar in A ? I have other scripts with list controls - there, a call (in B) such as

guisendmsg(progress_fld, 'ADDSTRING', , string)

works with no problem, so I tried with that as well, but to no avail.
Message2.
#13241
Posted by: Jeff Glatt 2010-03-11 19:15:54
Probably need to empty out the messages before you see any change.
Message3. Can't remember how to do this
#13525
Posted by: Michael S 2011-10-05 18:44:07 Last edited by: Michael S 2011-10-05 18:45:09 (Total edited 2 times)
I'm running into the same problem in another script. In A, I have

statusbarwidths.1 = 100
statusbarwidths.2 = -1
guiaddctltext('status_bar', 2, 'statusbarwidths')

and in B, I have

PROCEDURE EXPOSE sw_array guiwindow status_bar_handle
.
.
.
	DO
		status_bar = 'Analyzing line 'curr' of 'sourcecode.0
		guisetctlvalue(status_bar_handle, 1)
		CATCH SYNTAX
		NOP
	END

but I never see anything. Note that if I add the code to A

			status_bar_handle = get_handle('status_bar')		
			status_bar = 'Hello'
			guisetctlvalue(status_bar_handle,1)	

then I never see anything. If I change the code to

			status_bar_handle = get_handle('status_bar')		
			status_bar = 'Hello'
			guisetctlvalue('status_bar',1)	

then I see Hello as expected.
Message4.
#13526
Posted by: Jeff Glatt 2011-10-10 11:46:03
The GuiWindow variable first needs to be set to the handle of the window (containing the status bar).
Message5. Sorry, my bad
#13527
Posted by: Michael S 2011-10-10 20:46:09
Programming error - I thought I was passing in a valid handle, but I wasn't. Have improved my error handling for that sort of error. Thanx
Message6. I'm going to add this as an append since I fell over again with the same problem (and error)
#13571
Posted by: Michael S 2012-01-14 00:24:39
The problem (for me) was the fact that I get the handle by calling GET_HANDLE. This in turn looks through a stem variable called wdw_size.

If the control isn't there, then it won't work. Summa summarum - check the procedure called get_control_size_pos:
Message7. .... plus something Jeff suggested above
#13572
Posted by: Michael S 2012-01-14 04:07:31
If you don't see anything in the status field, try adding the following code

	guigetmsg('CLEAR')

after your write to the status bar. That helped just now when I was wasn't seeing anything
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