Can I stop saving changes on a window close? (OpenInsight Specific)
At 25 AUG 1999 06:49:07PM Robert Dunmire wrote:
I was attempting to create read-only windows. My overly simplistic approach was to copy the window and remove the write and delete capabilities from the menu. However, if anything is changed in the window upon closing you get the option to save the changes. Thats a no no these are boss types and they must not be allowed to change anything accidently or on purpose.
I've got over fifty forms in this application and there has got to be an easier way than going thru all the controls on all the forms and setting them to read-only or disabling them.
I've seen discussion here about doing something to test for the user and then setting something to read-only but I don't know if that will work here. I will have a variety of users that will have access to different things. Some a accessable to all, some acessable by some and read-only to others, and some that a accessable to only one.
The longer I write the more confusing it gets. If I could just eliminate the save option on window close I would be in the berries.
Any help will be appreciated.
Robert
At 25 AUG 1999 09:05PM akaplan@sprezzatura.com - [url=http://www.sprezzatura.com]Sprezzatura Group[/url] wrote:
Don't know how slick you want to make this, but if you just do a RETURN 0 from an event, the default processing won't occur. So, do something like
If @UserName=SUIT_GUY' Else Call Forward_Event([i]params[/i])EndReturn 0Forward_Event() tells it to continue the event chain. The return 0 tells the system to stop processing. No processing, no save, in theory.
akaplan@sprezzatura.com
At 26 AUG 1999 04:32AM cpates@sprezzatura.com - [url=http://www.sprezzatura.com]Sprezzatura Group[/url] wrote:
Robert,
You could also do this in a CLOSE event script ( not a QuickEvent as it's too late then.. )
If @UserName=POINTY_HAIRED_GUY" Then CurrentCtrl=Get_Property( @Window, "FOCUS" ) Call Send_Event( CurrentCtrl, "LOSTFOCUS" ) Call Set_Property( @Window, "SAVEWARN", 0 ) End RETURN 1This fires off a LOSTFOCUS to the control with focus that allows it to notify the window of any changes via SAVEWARN. We then set SAVEWARN to FALSE so the default CLOSE logic doesn't detect that any changes have been made and you never see the save dialog box.
cpates@sprezzatura.com
World Leaders in all things RevSoft
At 26 AUG 1999 03:13PM Robert Dunmire wrote:
Carl
I placed your suggestion in both CLOSE & CLEAR events and it was working well until I found an exception.
If I modify an Edit Line/Box(haven't tried anything else) and if I don't tab out of it I still get the save dialog box when I close the form. I checked and the status of the SAVEWARN is set to 0 but still getting dialog box.
Now if I tab to next control everything works as expected ie no dialog box.
With my limited understanding it appears the LOSTFOCUS isn't firing and again because of my limited understanding I don't know how to fix it.
Any suggestions?
TIA
Robert
At 26 AUG 1999 09:55PM Don Bakke wrote:
Robert,
In your CLOSE/CLEAR events, set the FOCUS to another edit control before anything else.
dbakke@srpcs.com
At 27 AUG 1999 01:48AM Robert Dunmire wrote:
Hi Don
Exactly what I would like to do since if I manually tab to another control it accomplished what I want.
I can't come up with a generic way to shift focus rather than specify the name of another object to get focus. Is there a way to change focus to the next control in the tab order for example? I don't think it would make any difference what kind of control it was just something new before setting the SAVEWARN.
Robert
At 27 AUG 1999 05:07AM Oystein Reigem wrote:
Robert,
…change focus to the next control in the tab order…
Shouldn't something like this work?
/* Step 1: Determine which control is next in the tab order */
CurrentCtrl=Get_Property( "SYSTEM", "FOCUS" )
NextCtrl=Get_Property( CurrentCtrl , "NEXT" )
/* Step 2: Change focus */
UnUsed=Set_Property( "SYSTEM", "FOCUS", NextCtrl )
- Oystein -
At 27 AUG 1999 09:10AM Don Bakke wrote:
I would think you would still need to check what TYPE the control is since Static controls, AFAIK, can appear in the tab order. In that case just loop until the control begins with "EDIT"
dbakke@srpcs.com
At 27 AUG 1999 09:45AM Don Bakke wrote:
On further reflection, the control that eventually gets focus should not be an EDITBOX because of the existing problems where the GOTFOCUS_VALUE and TEXT properties don't match. This causes an immediately SAVEWARN message.
dbakke@srpcs.com
At 27 AUG 1999 12:53PM cpates@sprezzatura.com - [url=http://www.sprezzatura.com]Sprezzatura Group[/url] wrote:
Hi Don,
But will that make a difference as the user never gets chance to change the text because the CLOSE event is firing?
Just to add a little fuel
![]()
cpates@sprezzatura.com
World Leaders in all things RevSoft
At 27 AUG 1999 01:33PM akaplan@sprezzatura.com - [url=http://www.sprezzatura.com]Sprezzatura Group[/url] wrote:
Yes it does, since the generic close code looks at the current focus control and does the compare to see if this control has changed, since the lost-focus could be bypassed. Had to eventually write a promoted event for close and clear to see what control type I'm on and move to another if it's an editbox.
akaplan@sprezzatura.com