OI Baby Steps - Buttons & Scripts (OpenInsight Specific)
At 07 JAN 2001 08:23:32AM Roy Drummond wrote:
Don't feel like hiding now (thanks Don), but still having some problems.
1) I have a table associated window (I think) but when I save it, the SEQKEY does not update and the data is not saved. I have a second window that saves fine. I can't even find where to ckeck back to find the table info. What areas can I compare between the windows to maybe find the problem.
2) I have an Exit button that runs 'Close the window' on a CLICK event. The window has several required fields. If the cursor is in a required field that is not all filled in, I get the message 'Data is required. The control may not be skipped.' How can I get it to work like the X close control that just asks 'Do you want to save changes to the entry?'? A response of 'No' there closes the window.
3) I have a field, TYPE, that I want to run one of three POPUPS based on the value of FAMILY. In the GETFOCUS Event I have added the following Script:
Declare Function POPUP
BEGIN CASE
CASE @RECORD=RED' (@RECORD is FAMILY)@ANS=POPUP(@WINDOW,'','POPUP**RED_POP')CASE @RECORD=WHITE'@ANS=POPUP(@WINDOW,'','POPUP**WHITE_POP')CASE @RECORD=BLUE'@ANS=POPUP(@WINDOW,'','POPUP**BLUE_POP')END CASE
RETURN 0
QuickEvent Options: - General (I have also tried 'Execute a procedure')
The POPUPs display like they should, but the result does not return to the field. I'm pretty sure the problem is in my 'Send message to:'
data. It is as follows:
Entry - checked
Combo Box - SYSPROG*ADDTYPE Message - EXECUTE Parameters - 'arg1',2,'arg3a','arg3b' Return value in: Control: @SELF PROPERTY: TEXT Any input would be GREATLY appreciated. Roy </QUOTE> —- === At 07 JAN 2001 08:11PM Donald Bakke wrote: === <QUOTE>Roy, 1) I have a table associated window (I think) but when I save it, the SEQKEY does not update and the data is not saved. I have a second window that saves fine. I can't even find where to ckeck back to find the table info. What areas can I compare between the windows to maybe find the problem. I suspect the SEQKEY isn't being updated because the data isn't being saved. That is, fix the problem with saving the data and I believe the SEQKEY will work again. Typically this can happen if you have a WRITE event that isn't returning a 1. Start there and let us know what you find. 2) I have an Exit button that runs 'Close the window' on a CLICK event. The window has several required fields. If the cursor is in a required field that is not all filled in, I get the message 'Data is required. The control may not be skipped.' How can I get it to work like the X close control that just asks 'Do you want to save changes to the entry?'? A response of 'No' there closes the window. When you have required fields the default behavour is that you will get warned at the point of losing focus of a required field. The X close button doesn't actually get focus so it doesn't fire the warning message. You can alter the behavour of default fields by modifying the IOOPTIONS property of the window. If field position 10 is set to a value of 1 then you only get the required fields warning when you attempt to write the data. You update this property in the CREATE event of your window. 3) I have a field, TYPE, that I want to run one of three POPUPS based on the value of FAMILY. In the GETFOCUS Event I have added the following Script: Declare Function POPUP BEGIN CASE CASE @RECORD=RED' (@RECORD is FAMILY) @ANS=POPUP(@WINDOW,
,'POPUPRED_POP') CASE @RECORD=WHITE' @ANS=POPUP(@WINDOW,
,'POPUPWHITE_POP') CASE @RECORD=BLUE' @ANS=POPUP(@WINDOW,'','POPUPBLUE_POP') END CASE RETURN 0 QuickEvent Options: - General (I have also tried 'Execute a procedure') The POPUPs display like they should, but the result does not return to the field. I'm pretty sure the problem is in my 'Send message to:' data. It is as follows: Entry - checked Combo Box - SYSPROG*ADD**TYPE Message - EXECUTE Parameters - 'arg1',2,'arg3a','arg3b' Return value in: Control: @SELF PROPERTY: TEXT[/i] The problem here is that QuickEvents do not coordinate with your event script this way. The only way QuickEvents return values is if the QuickEvent launches the PopUp. Obviously, however, you need something more sophisticated that what the QuickEvents can provide so you created a script. What you need to follow-up with is another line of code that takes the value in @ANS and updates the current control like this: rv=Set_Property(@Window:".TYPE", "DEFPROP", @ANS) By the way, @RECORD is not as reliable in OI as it is in AREV. You will property want to get the RECORD property of the form to use instead. dbakke@srpcs.com SRP Computer Solutions, Inc.
</QUOTE> —- === At 07 JAN 2001 11:20PM Roy wrote: === <QUOTE>Don, 1) I suspect the SEQKEY isn't being updated because the data isn't being saved. That is, fix the problem with saving the data and I believe the SEQKEY will work again. Typically this can happen if you have a WRITE event that isn't returning a 1. Start there and let us know what you find. This Save Event is a CLICK Quick Event with 'Write the row' selected and Control/Window selected. Everything else in inactive. How do I check to see if it is being written and 1 is returned? 2) When you have required fields the default behavour is that you will get warned at the point of losing focus of a required field. The X close button doesn't actually get focus so it doesn't fire the warning message. You can alter the behavour of default fields by modifying the IOOPTIONS property of the window. If field position 10 is set to a value of 1 then you only get the required fields warning when you attempt to write the data. You update this property in the CREATE event of your window. Where are IOOPTIONS and CREATE event accessed? 3) rv=Set_Property(@Window:".TYPE", "DEFPROP", @ANS) I entered this line as is and it worked great…the first few times. Then I got no POPUP at all. I have checked the code, options, etc. with what was included in the original posting and it is the same now, but I think I may have double clicked where I should have single clicked and may have cleared/changed some fields. I did not make the changes to @RECORD. Maybe I should have. Any ideas how to get my POPUPs back? 4) New Question - What is the format for passing data via dictionary names to a SP via the Parameters field? Roy </QUOTE> —- === At 08 JAN 2001 04:16AM Oystein Reigem wrote: === <QUOTE>Roy, This Save Event is a CLICK Quick Event with 'Write the row' selected and Control/Window selected. Everything else in inactive. How do I check to see if it is being written and 1 is returned? The theory is you have a user event on your CLICK in addition to your quickevent. The user event runs before the quickevent. If you have a return 0 statement in your user event processing will stop before the quickevent gets a chance to run. To get to the user event press the Scripts… key in the QuickEvent dialog. This brings up the Event Editor. Have you entered your own programming here? In case make sure the return statement(s) says return 1 and not return 0. A 0 will cause event processing to halt. A 1 will cause processing to continue with the next step in the chain - the quickevent. Note that if you have not made a user event the Event Editor will still show a rudimentary piece of code consisting of single return 0 statement preceeded by an empty line. But don't be fooled. The user event isn't really there. The makers of OI just designed the Event Editor this way, perhaps to have a laugh at our expense. But also note it doesn't take much before OI believes you have a user event. Just enter a single space in the empty line, and compile (File | Exit/Update, or Ctrl-S). Presto - you have a user event that does nothing, except to cause processing to halt after it's done. And it's impossible to distinguish from a non-existing user event. If in doubt - just clear the user event (Event Editor - Edit | Clear Event + File | Exit/Update)!!!!! - Oystein - </QUOTE> —- === At 08 JAN 2001 02:50PM Don Miller - C3 Inc. wrote: === <QUOTE>In addition, you can do pre-and post processing in the Script. What you do is .. do your pre-processing ..execute a FORWARD_EVENT(@WINDOW,"WRITE") to make the write event fire, then you get control after .. you can then do any post-write processing you might need. Note that the FORWARD_EVENT call to Write will allow you to re-read the record just written to check things, if necessary. At the end, you still want to execute a Return 1 to allow any other events to fire. HTH Don Miller C3 Inc. </QUOTE> View this thread on the forum...