|
|||||||
Deep Zoom RevisitedThanks to Les Palenik of Cosmotron Systems Ltd. for pointing out a useful and aesthetic technique to eliminate redundant softkeys (see last issue). Les stated that the only limitation of his routine was that it required the user to be positioned in the actual prompt before pressing SF3 rather than having it available throughout the window as a normal softkey. To overcome this limitation, I've extended the code to that shown below (as always, source will be available on the next utility diskette if you can wait that long.) In addition, I've corrected a slight oversight in the original code which would have led to errors if Deep Zoom was used on multivalued data (note the convert statement near the end!). If the user is NOT in a Deep Zoom prompt, then an anchored popup is displayed showing all of the associated windows available. It establishes this information by scanning the WC_W% array looking for information in prompt register 1. (The original code used WC_Prompts%, but the dimensioned array used here gives faster results in the loop.) The user can then access the window(s) of their choice. The format of the information stored in the prompt register has also been enhanced; it should now be in the form WindowName, (Description), (NullSuppress) (although the code is backward compatible for any existing windows!) WindowName functions exactly as before. Description should contain brief text about the related window for inclusion in the popup (CUST_REL_INV might not mean anything to the average user!). Finally, the optional parameter NullSuppress, if set to true, tells the routine NOT to present the related window if there is no data in the relevant column of the current row. It is also now possible to include the routine on a macro keystroke (ideally Alt-3) as well as/instead of the previously recommended SF3 softkey. This is made possible by a simple check on @Tutor (see RevMedia passim) but note that if the user has access to system windows which use register 1 for other nefarious purposes, then a more rigorous check might be required later in the program. 0001 Subroutine DeepZoom 0002 /* 0003 Author Cameron Christie (Sprezzatura Ltd) 0004 Date April 1993 0005 Purpose To provide alternate deep zoom functionality 0006 0007 Acknowledgements to Les Palenik (Cosmotron Systems Ltd) 0008 */ 0009 0010 * Add check to permit macro operation. 0011 0012 If @Tutor[-6,6] # "WINDOW" Then Return 0013 $Insert SysInclude,Window_Common% 0014 0015 Declare Subroutine Msg,Catalyst,Video.Rw 0016 Declare Function Pop.Up 0017 0018 WindowDetails = WC_W%(WC_Wi%)<47> 0019 WindowName = Field(WindowDetails,",",1) 0020 0021 If WindowName Then 0022 * We are in a prompt with a related window. 0023 NullSuppress = Field(WindowDetails,",",3) 0024 RelatedKeys = WC_Is% 0025 Gosub CallWindow 0026 End Else 0027 * Scan the W% array for ALL applicable related windows. 0028 Row = @Record 0029 Row<WC_Si%<4>,WC_Mv%> = WC_Is% 0030 Disp = "" 0031 RelatedData = "" 0032 For I = 1 To WC_W_Cnt% 0033 WindowDetails = WC_W%(I)<47> 0034 If WindowDetails Then 0035 WindowName = Field(WindowDetails,",",1) 0036 Description = Field(WindowDetails,",",2) 0037 NullSuppress = Field(WindowDetails,",",3) 0038 RelatedKeys = Row<WC_W%(I)<4>> 0039 If RelatedKeys OR Not(NullSuppress) Then 0040 If Description Else Description = WindowName 0041 Disp := Description: @Vm :WindowName : @Fm 0042 RelatedData := RelatedKeys : @Fm 0043 End 0044 End 0045 Next I 0046 If Disp Then 0047 Disp[-1,1] = "" 0048 NullSuppress = 0 ; * Null checks have already been applied! 0049 Gosub SelectWindow 0050 End Else 0051 Msg("|No related windows to zoom to!|") 0052 End 0053 End 0054 Return 0055 0056 SelectWindow: 0057 F = "1:30:L::" 0058 T = "|Please select related window|" 0059 C = "" 0060 T2 = "P" : @Svm : 1 0061 Video.Rw(0,0,@CrtWide-1,@CrtMaxHigh-1,"R",Image) 0062 Loop 0063 Choice= Pop.Up(2,2,"",Disp,F,"R",0,T,"","",C,T2) 0064 While Choice 0065 WindowName = Disp<Choice,2> 0066 RelatedKeys = RelatedData<Choice> 0067 Gosub CallWindow 0068 Repeat 0069 Video.Rw(0,0,@CrtWide-1,@CrtMaxHigh-1,"W",Image) 0070 Return 0071 0072 CallWindow: 0073 If RelatedKeys OR Not(NullSuppress) Then 0074 Convert @Vm To " " In RelatedKeys 0075 Catalyst("W",WindowName:" ":RelatedKeys) 0076 End Else 0077 Msg("|No data in this column to zoom!|") 0078 End 0079 Return (Volume 4, Issue 10, Pages 13-15) |
|||||||
| |||||||