#pragma TextEncoding = "UTF-8" #pragma rtGlobals=3 // Use modern global access method and strict wave access. Function DataValueHookFunc(Data) STRUCT WMWinHookStruct &Data Switch (Data.EventCode) Case 7: NVar ValP=root:Packages:DataValue:$(data.WinName):$("Csr"+Data.CursorName+"_ValP") NVar ValX=root:Packages:DataValue:$(data.WinName):$("Csr"+Data.CursorName+"_ValX") NVar ValY=root:Packages:DataValue:$(data.WinName):$("Csr"+Data.CursorName+"_ValY") NVar ValD=root:Packages:DataValue:$(data.WinName):$("Csr"+Data.CursorName+"_ValData") NVar MC=root:Packages:DataValue:$(data.WinName):MaxCursor SVar N_X=root:Packages:DataValue:$(data.WinName):S_NameX SVar N_Y=root:Packages:DataValue:$(data.WinName):S_NameY SVar N_D=root:Packages:DataValue:$(data.WinName):S_NameData Wave W_X=$N_X, W_Y=$N_Y, W_D=$N_D ValP=Data.PointNumber ValX=W_X[Data.PointNumber] ValY=W_Y[Data.PointNumber] ValD=W_D[Data.PointNumber] StrSwitch (Data.CursorName) Case "A": Case "B": If (MC>0) NVar AP=root:Packages:DataValue:$(data.WinName):CsrA_ValP NVar AX=root:Packages:DataValue:$(data.WinName):CsrA_ValX NVar AY=root:Packages:DataValue:$(data.WinName):CsrA_ValY NVar AD=root:Packages:DataValue:$(data.WinName):CsrA_ValData NVar BP=root:Packages:DataValue:$(data.WinName):CsrB_ValP NVar BX=root:Packages:DataValue:$(data.WinName):CsrB_ValX NVar BY=root:Packages:DataValue:$(data.WinName):CsrB_ValY NVar BD=root:Packages:DataValue:$(data.WinName):CsrB_ValData NVar ABP=root:Packages:DataValue:$(data.WinName):DeltaAB_ValP NVar ABX=root:Packages:DataValue:$(data.WinName):DeltaAB_ValX NVar ABY=root:Packages:DataValue:$(data.WinName):DeltaAB_ValY NVar ABD=root:Packages:DataValue:$(data.WinName):DeltaAB_ValData ABP=AP-BP ABX=AX-BX ABY=AY-BY ABD=AD-BD EndIf Break Default: Break EndSwitch Break Default: Break EndSwitch Return 0 End Function CreateDataValuePanel(WindowName, MaxCursor) String WindowName Variable MaxCursor Variable i If ((Maxcursor < 1) || (MaxCursor > 10)) Print "Number of Cursors must be 1..10" Return -1 EndIf If (StrLen(WindowName)==0) WindowName=Winname(0,1) EndIf If (MaxCursor>1) NewPanel /EXT=2 /HOST=$WindowName /W=(0,20,(MaxCursor+1)*80+60,110) as "Data values from x,y,d triplets" Else NewPanel /EXT=2 /HOST=$WindowName /W=(0,20,80+60,110) as "Data values from x,y,d triplets" EndIf TitleBox T_C, Pos={10,10}, Frame=0, FStyle=1, FixedSize=1, Title="Cursor" TitleBox T_P, Pos={10,30}, Frame=0, FStyle=1, FixedSize=1, Title="Point" TitleBox T_X, Pos={10,50}, Frame=0, FStyle=1, FixedSize=1, Title="X-Value" TitleBox T_Y, Pos={10,70}, Frame=0, FStyle=1, FixedSize=1, Title="Y-Value" TitleBox T_D, Pos={10,90}, Frame=0, FStyle=1, FixedSize=1, Title="Data" For (i=0;i1) TitleBox T_DeltaAB, Pos={i*80+80,10}, Frame=0, FStyle=1, FixedSize=1, Title="Delta AB" ValDisplay DeltaAB_P, Pos={i*80+80,30}, bodyWidth=70, Frame=0, Title=" ", Value=#("root:Packages:DataValue:"+WindowName+":DeltaAB_ValP") ValDisplay DeltaAB_X, Pos={i*80+80,50}, bodyWidth=70, Frame=0, Title=" ", Value=#("root:Packages:DataValue:"+WindowName+":DeltaAB_ValX") ValDisplay DeltaAB_Y, Pos={i*80+80,70}, bodyWidth=70, Frame=0, Title=" ", Value=#("root:Packages:DataValue:"+WindowName+":DeltaAB_ValY") ValDisplay DeltaAB_D, Pos={i*80+80,90}, bodyWidth=70, Frame=0, Title=" ", Value=#("root:Packages:DataValue:"+WindowName+":DeltaAB_ValData") EndIf Return 0 End Function InstallDataPanelHook(WindowName, MaxCursor, W_X, W_Y, W_Data) String WindowName Variable MaxCursor Wave W_x, W_Y, W_Data Variable i If (!DataFolderExists("root:Packages")) NewDataFolder root:Packages EndIf If (!DataFolderExists("root:Packages:DataValue")) NewDataFolder root:Packages:DataValue EndIf If (!DataFolderExists("root:Packages:DataValue:"+WindowName)) NewDataFolder root:Packages:DataValue:$WindowName EndIf Variable /G root:Packages:DataValue:$(WindowName):MaxCursor=MaxCursor If (CreateDataValuePanel(WindowName, MaxCursor)==0) For (i=0;i