X that closes the window (OpenInsight 32-Bit)
At 07 DEC 2007 01:02:45PM Kauko Laurinolli wrote:
In Close event of my window I have some code:
If Modify=0 Then
Set_Property(@Window,'SAVEWARN',False$)Forward_Event(0,1,0)End Else
Forward_Event()End
which works fine when clicking the Exit Button and doesn't ask to save the changes if Modify=0 but if I exit window by using Esc key, Alt-F4 or X in the screen corner it will ask this question.
How do I link these other ways to close the windows into my close event code?
At 11 DEC 2007 02:53AM dbakke@srpcs.com's Don Bakke wrote:
Kauko,
I'm having a hard time understanding your CLOSE event logic. Are you sure this is in your CLOSE event script? Why does the Forward_Event subroutine have three parameters if this is in the CLOSE event.
dbakke@srpcs.com
At 11 DEC 2007 07:25AM Kauko Laurinolli wrote:
Some people have read but not modify rights so for them I set Mofify=0.
If Modify=0 the window will not ask if they want to save the changes even if they have done changes into the window.
At 11 DEC 2007 09:50AM dbakke@srpcs.com's Don Bakke wrote:
Kauko,
Hmmm…well my point was that I don't think your logic is exactly correct. IMO, the Forward_Event call isn't formatted correctly for the CLOSE event handler. I don't see how your code works for you at all, regardless of how the window gets closed.
dbakke@srpcs.com
At 11 DEC 2007 12:16PM Kauko Laurinolli wrote:
Don't know what to say but been using it successfully for years.
I had to design my own User Level system (0 - 6) to facilitate the different access rights to entry screens and reports.
Call Forward_Event(bsavekey, bsuppresswarning, bmaintainfocus),
Forward_Event(0,1,0) suppresses the question: Would you like to save changes to the entry? which is the whole point of this.
Just don't know how to link X, Esc key and Alt-F4 the Close Event.
Please, if you have better suggestion how to do this?
At 11 DEC 2007 02:42PM dbakke@srpcs.com's Don Bakke wrote:
[/i]I had to design my own User Level system (0 - 6) to facilitate the different access rights to entry screens and reports.[/i]
Yep, we do something similar. Your approach is akin to the AREV restriction level. We use role-bases security.
Call Forward_Event(bsavekey, bsuppresswarning, bmaintainfocus)
These parameters suggest the CLEAR event handler, not the CLOSE event handler. That's why I am confused. Can you confirm where, exactly, your logic exists? Is it in a script event handler? If so, which one?
Just don't know how to link X, Esc key and Alt-F4 the Close Event. Please, if you have better suggestion how to do this?
I'm not sure I am covering everything you need to do but using this code in the CLOSE event script works for me:
Declare subroutine [/color]Forward_Event, Set_Property [/color] [/color]// Logic to get modify rights goes here... [/color] [/color]If [/color]Modify=[/color]0 [/color]Then [/color]Set_Property([/color]@Window[/color],[/color]'SAVEWARN'[/color],[/color]0[/color]) [/color]end [/color] RETURN [/color]1[/color][/color][/size]dbakke@srpcs.com
At 11 DEC 2007 03:02PM Kauko Laurinolli wrote:
Thanks. That works well but if I click the X in the screen corner then the Close Event code is ignored? Same w/ Close in the Menu, Esc and Alt-F4.
At 11 DEC 2007 06:06PM dbakke@srpcs.com's Don Bakke wrote:
Kauko,
I'm not sure if you are asking me a question or if you are telling me what you are experiencing. This logic should work regardless of the way the end user closes the form. I tried it using Alt-F4, the X, and a pushbutton on the form that tells the form to close.
If you are telling me that it doesn't work for all scenarios then please be more specific and I'll try to help you out.
dbakke@srpcs.com
At 12 DEC 2007 06:57AM Kauko Laurinolli wrote:
The goal of this is to prevent question: Would you like to save changes to the entry? (under any conditions) if Modify=0.
What I am saying is that:
If Modify=0 Then
Set_Property(@Window,'SAVEWARN',0)End
code is ignored (not executed) if I click the X in the screen corner or select Close in the Menu, press Esc or Alt-F4.
This is of course if Modify=0 and the user has changed the text in the entry window. The question: Would you like to save changes to the entry? is popping up when it was not suppose to do that.
If I click Exit button (linked to Close window quick event option) this question will not show up which is the whole purpose if this code.
At 12 DEC 2007 10:10AM dbakke@srpcs.com's Don Bakke wrote:
Kauko,
Are you using multiline editboxes in your forms?
dbakke@srpcs.com
At 13 DEC 2007 08:20AM Kauko Laurinolli wrote:
Thanks,
Only one window seem to have multi-line edit box.
All of them have multi-line edit tables (many of them non-visible to work w/ multiple SRP's ole_edittables).
I took a simple two editline screen and added following close event:
declare subroutine Set_Property
Modify=0
If Modify=0 Then Set_Property(@Window,'SAVEWARN',0)
Return 1
Also in this case exit button and other ways to close the window behave differently as I explained before?
All I am looking for that that they all would execute the code in close event.
At 19 JAN 2008 02:10AM dbakke@srpcs.com's Don Bakke wrote:
Kauko,
I reviewed this problem again for you after reading about it in the bug tracker. I think I know what the problem is. You may want to see my response there. Let me know if this resolves your problem.
dbakke@srpcs.com