.============================================================
.  YOUR SUBROUTINES -- Write your VNW logic here
.
.  In every subroutine, each control has its own auto-set variables:
.    [ctrl_id.name]   = ID of the control that fired
.    [ctrl_id.event]  = event name (e.g. Left_Click, Value_Changed)
.    [ctrl_id.value]  = current value / state of the control
.    [ctrl_id.sub]    = primary subroutine name
.    [ctrl_id.prop]   = primary property name
.
.  To set a control property from VNW:
.    SetVar "[lbl_result.caption]"   "Hello!"
.    SetVar "[SetObjectProperty]"    "lbl_result.caption"
.    GoSub "SetProp"
.
.  Or use the Companion plugin command:
.    NWID_Set "Rectangle1" "label:lbl_result" "caption" "Hello!"
.============================================================

.------------------------------------------------------------
. Control : btn_agregar  (button)
. Event   : Left_Click
. Page    : Main
.------------------------------------------------------------
:OnAgregarGasto
. Available variables:
.   [btn_agregar.name]   = "btn_agregar"
.   [btn_agregar.event]  = Left_Click
.   [btn_agregar.caption] = current value / state of the control

Return

.------------------------------------------------------------
. Control : btn_calcular  (button)
. Event   : Left_Click
. Page    : Main
.------------------------------------------------------------
:OnCalcularGastos
. Available variables:
.   [btn_calcular.name]   = "btn_calcular"
.   [btn_calcular.event]  = Left_Click
.   [btn_calcular.caption] = current value / state of the control

Return

.------------------------------------------------------------
. PAGE EVENTS — one pair per page
. Add your logic above each Return
.------------------------------------------------------------

:Main_OnEnter
. Fires every time the Main page becomes active
. [NWID.PageName] = Main
Return

:Main_OnExit
. Fires just before leaving the Main page
. [NWID.PageName] = Main
Return

.------------------------------------------------------------
. :NWID_OnReady -- fires once when the runtime is fully loaded
.   All per-control variables are already initialised.
.   Use this for one-time startup logic (load data, set defaults, etc.)
.------------------------------------------------------------
:NWID_OnReady
. Add your startup logic here
Return

.------------------------------------------------------------
. :NWID_OnPageChanged -- fires after every page change (global)
.   [NWID.PageName]  = name of the new active page
.   [NWID.PageIndex] = 0-based index of the new active page
.------------------------------------------------------------
:NWID_OnPageChanged
. Add your page-change logic here
Return

.------------------------------------------------------------
. :NWID_OnPropValue -- fires when NWID_Get returns a value.
.   [NWID.PropName]  = property that was read
.   [NWID.PropValue] = the returned value
.------------------------------------------------------------
:NWID_OnPropValue
. Fires when getProp() returns a value.
. [NWID.PropName] = property name
. [NWID.PropValue] = value returned
Return


.============================================================
.  NWID RUNTIME SUBROUTINES -- AUTO-GENERATED
.  NeoWin Interface Designer
.
.  *** DO NOT EDIT ANYTHING BELOW THIS LINE ***
.  *** Re-export from NWID to regenerate      ***
.============================================================

.============================================================
.  INFRASTRUCTURE -- Do not edit
.============================================================

:Initialize
ezEdgeAvailable "[isEdgeAvailable]" "[Result]"
If "[isEdgeAvailable]" "=" "True"
  ezEdgeCreate "Rectangle1" "[TempDir]NWIDCache" "NWID_EdgeReady" "" "[Result]"
Else
  AlertBox "Error" "WebView2 Runtime is required.[#13]Please install it from Microsoft."
  Run "explorer.exe" "https://developer.microsoft.com/en-us/microsoft-edge/webview2/#download-section" "Normal" "" ""
  Exit "" ""
EndIf
Return

:NWID_EdgeReady
ezEdgeMessageReceived "Rectangle1" "[NWID.Msg]" "NWID_OnMessage" "[Result]"
ezEdgeNavComplete "Rectangle1" "[NWID.NavTitle]" "NWID_OnNavComplete" "[Result]"
SetVar "[NWID.Rect]" "Rectangle1"
. *** Load your exported runtime HTML below -- update the path ***
. ezEdgeGoTo "Rectangle1" "[PubDir]runtime.html" "[Result]"
Return

:NWID_OnNavComplete
ezEdgeMessageReceived "Rectangle1" "[NWID.Msg]" "NWID_OnMessage" "[Result]"
. NWID_OnReady fires when the runtime sends NWID_READY: (after JS initialises).
. Do NOT GoSub NWID_OnReady here -- controls are not set up yet at nav time.
Return

:NWID_OnMessage
SetVar "[NWID.Rect]" "Rectangle1"
SearchStr "NWID_ROWDATA:" "[NWID.Msg]" "[_NP]" "CaseSensitive"
If "[_NP]" "=" "1"
  StrLen "[NWID.Msg]" "[_NL]"
  SubStr "[NWID.Msg]" "14" "[_NL]-13" "[_RD]"
  SearchStr "|" "[_RD]" "[_RP]" "CaseSensitive"
  If "[_RP]" ">" "0"
    SubStr "[_RD]" "1" "[_RP]-1" "[NWID.Row]"
    SubStr "[_RD]" "[_RP]+1" "[_NL]" "[NWID.RowData]"
  Else
    SetVar "[NWID.Row]" "[_RD]"
    SetVar "[NWID.RowData]" ""
  EndIf
  StrParse "[NWID.RowData]" "|" "[tbl_gastos.col]" "[tbl_gastos.colCount]"
EndIf
SearchStr "NWID_GOSUB:" "[NWID.Msg]" "[_NP]" "CaseSensitive"
If "[_NP]" "=" "1"
  StrLen "[NWID.Msg]" "[_NL]"
  SubStr "[NWID.Msg]" "12" "[_NL]-11" "[_NP1]"
  SearchStr "|" "[_NP1]" "[_P1]" "CaseSensitive"
  If "[_P1]" ">" "0"
    SubStr "[_NP1]" "1" "[_P1]-1" "[NWID.SubName]"
    SubStr "[_NP1]" "[_P1]+1" "[_NL]" "[_NP2]"
    SearchStr "|" "[_NP2]" "[_P2]" "CaseSensitive"
    If "[_P2]" ">" "0"
      SubStr "[_NP2]" "1" "[_P2]-1" "[NWID.ObjName]"
      SubStr "[_NP2]" "[_P2]+1" "[_NL]" "[_NP3]"
      SearchStr "|" "[_NP3]" "[_P3]" "CaseSensitive"
      If "[_P3]" ">" "0"
        SubStr "[_NP3]" "1" "[_P3]-1" "[NWID.EventName]"
        SubStr "[_NP3]" "[_P3]+1" "[_NL]" "[_NP4]"
        SearchStr "|" "[_NP4]" "[_P4]" "CaseSensitive"
        If "[_P4]" ">" "0"
          SubStr "[_NP4]" "1" "[_P4]-1" "[NWID.Value]"
          SubStr "[_NP4]" "[_P4]+1" "[_NL]" "[_NP5]"
          SearchStr "|" "[_NP5]" "[_P5]" "CaseSensitive"
          If "[_P5]" ">" "0"
            SubStr "[_NP5]" "1" "[_P5]-1" "[NWID.Key]"
            SubStr "[_NP5]" "[_P5]+1" "[_NL]" "[_NP6]"
            SearchStr "|" "[_NP6]" "[_P6]" "CaseSensitive"
            If "[_P6]" ">" "0"
              SubStr "[_NP6]" "1" "[_P6]-1" "[NWID.KeyStr]"
              SubStr "[_NP6]" "[_P6]+1" "[_NL]" "[_NP7]"
              SearchStr "|" "[_NP7]" "[_P7]" "CaseSensitive"
              If "[_P7]" ">" "0"
                SubStr "[_NP7]" "1" "[_P7]-1" "[NWID.KeyCode]"
              EndIf
            EndIf
          EndIf
        Else
          SetVar "[NWID.Value]" "[_NP4]"
        EndIf
      EndIf
    EndIf
    If "[NWID.ObjName]" "=" "lbl_title"
      SetVar "[lbl_title.caption]" "[NWID.Value]"
      SetVar "[lbl_title.name]" "lbl_title"
      SetVar "[lbl_title.event]" "[NWID.EventName]"
      SetVar "[lbl_title.sub]"  ""
      SetVar "[lbl_title.prop]" "caption"
    EndIf
    If "[NWID.ObjName]" "=" "grp_form"
      SetVar "[grp_form.caption]" "[NWID.Value]"
      SetVar "[grp_form.name]" "grp_form"
      SetVar "[grp_form.event]" "[NWID.EventName]"
      SetVar "[grp_form.sub]"  ""
      SetVar "[grp_form.prop]" "caption"
    EndIf
    If "[NWID.ObjName]" "=" "txt_fecha"
      SetVar "[txt_fecha.value]" "[NWID.Value]"
      SetVar "[txt_fecha.name]" "txt_fecha"
      SetVar "[txt_fecha.event]" "[NWID.EventName]"
      SetVar "[txt_fecha.sub]"  ""
      SetVar "[txt_fecha.prop]" "value"
    EndIf
    If "[NWID.ObjName]" "=" "txt_detalle"
      SetVar "[txt_detalle.value]" "[NWID.Value]"
      SetVar "[txt_detalle.name]" "txt_detalle"
      SetVar "[txt_detalle.event]" "[NWID.EventName]"
      SetVar "[txt_detalle.sub]"  ""
      SetVar "[txt_detalle.prop]" "value"
    EndIf
    If "[NWID.ObjName]" "=" "txt_compartido"
      SetVar "[txt_compartido.value]" "[NWID.Value]"
      SetVar "[txt_compartido.name]" "txt_compartido"
      SetVar "[txt_compartido.event]" "[NWID.EventName]"
      SetVar "[txt_compartido.sub]"  ""
      SetVar "[txt_compartido.prop]" "value"
    EndIf
    If "[NWID.ObjName]" "=" "txt_personal"
      SetVar "[txt_personal.value]" "[NWID.Value]"
      SetVar "[txt_personal.name]" "txt_personal"
      SetVar "[txt_personal.event]" "[NWID.EventName]"
      SetVar "[txt_personal.sub]"  ""
      SetVar "[txt_personal.prop]" "value"
    EndIf
    If "[NWID.ObjName]" "=" "btn_agregar"
      SetVar "[btn_agregar.caption]" "[NWID.Value]"
      SetVar "[btn_agregar.name]" "btn_agregar"
      SetVar "[btn_agregar.event]" "[NWID.EventName]"
      SetVar "[btn_agregar.sub]"  "OnAgregarGasto"
      SetVar "[btn_agregar.prop]" "caption"
    EndIf
    If "[NWID.ObjName]" "=" "btn_calcular"
      SetVar "[btn_calcular.caption]" "[NWID.Value]"
      SetVar "[btn_calcular.name]" "btn_calcular"
      SetVar "[btn_calcular.event]" "[NWID.EventName]"
      SetVar "[btn_calcular.sub]"  "OnCalcularGastos"
      SetVar "[btn_calcular.prop]" "caption"
    EndIf
    If "[NWID.ObjName]" "=" "tbl_gastos"
      SetVar "[tbl_gastos.row]" "[NWID.Value]"
      SearchStr "~" "[NWID.Value]" "[_TP]" "CaseSensitive"
      If "[_TP]" ">" "0"
        SubStr "[NWID.Value]" "1" "[_TP]-1" "[tbl_gastos.row]"
        StrLen "[NWID.Value]" "[_TL]"
        SubStr "[NWID.Value]" "[_TP]+1" "[_TL]" "[tbl_gastos.cell]"
      Else
        SetVar "[tbl_gastos.row]" "[NWID.Value]"
        SetVar "[tbl_gastos.cell]" ""
      EndIf
      SetVar "[tbl_gastos.name]" "tbl_gastos"
      SetVar "[tbl_gastos.event]" "[NWID.EventName]"
      SetVar "[tbl_gastos.sub]"  ""
      SetVar "[tbl_gastos.prop]" "row"
    EndIf
    If "[NWID.ObjName]" "=" "lbl_total_compartido"
      SetVar "[lbl_total_compartido.caption]" "[NWID.Value]"
      SetVar "[lbl_total_compartido.name]" "lbl_total_compartido"
      SetVar "[lbl_total_compartido.event]" "[NWID.EventName]"
      SetVar "[lbl_total_compartido.sub]"  ""
      SetVar "[lbl_total_compartido.prop]" "caption"
    EndIf
    If "[NWID.ObjName]" "=" "lbl_total_personal"
      SetVar "[lbl_total_personal.caption]" "[NWID.Value]"
      SetVar "[lbl_total_personal.name]" "lbl_total_personal"
      SetVar "[lbl_total_personal.event]" "[NWID.EventName]"
      SetVar "[lbl_total_personal.sub]"  ""
      SetVar "[lbl_total_personal.prop]" "caption"
    EndIf
    If "[NWID.ObjName]" "=" "lbl_parte1"
      SetVar "[lbl_parte1.caption]" "[NWID.Value]"
      SetVar "[lbl_parte1.name]" "lbl_parte1"
      SetVar "[lbl_parte1.event]" "[NWID.EventName]"
      SetVar "[lbl_parte1.sub]"  ""
      SetVar "[lbl_parte1.prop]" "caption"
    EndIf
    If "[NWID.ObjName]" "=" "lbl_parte2"
      SetVar "[lbl_parte2.caption]" "[NWID.Value]"
      SetVar "[lbl_parte2.name]" "lbl_parte2"
      SetVar "[lbl_parte2.event]" "[NWID.EventName]"
      SetVar "[lbl_parte2.sub]"  ""
      SetVar "[lbl_parte2.prop]" "caption"
    EndIf
    If "[NWID.ObjName]" "=" "lbl_final"
      SetVar "[lbl_final.caption]" "[NWID.Value]"
      SetVar "[lbl_final.name]" "lbl_final"
      SetVar "[lbl_final.event]" "[NWID.EventName]"
      SetVar "[lbl_final.sub]"  ""
      SetVar "[lbl_final.prop]" "caption"
    EndIf
    If "[NWID.SubName]" "<>" ""
      GoSub "[NWID.SubName]"
    EndIf
  EndIf
EndIf
SearchStr "NWID_VALUE:" "[NWID.Msg]" "[_NP]" "CaseSensitive"
If "[_NP]" "=" "1"
  StrLen "[NWID.Msg]" "[_NL]"
  SubStr "[NWID.Msg]" "12" "[_NL]-11" "[_VP]"
  SearchStr "|" "[_VP]" "[_PP]" "CaseSensitive"
  If "[_PP]" ">" "0"
    SubStr "[_VP]" "1" "[_PP]-1" "[NWID.PropName]"
    SubStr "[_VP]" "[_PP]+1" "[_NL]" "[NWID.PropValue]"
  Else
    SetVar "[NWID.PropName]" "[_VP]"
    SetVar "[NWID.PropValue]" ""
  EndIf
  GoSub "NWID_OnPropValue"
EndIf
SearchStr "NWID_READY:" "[NWID.Msg]" "[_NP]" "CaseSensitive"
If "[_NP]" "=" "1"
  StrLen "[NWID.Msg]" "[_NL]"
  SubStr "[NWID.Msg]" "12" "[_NL]-11" "[_DIMS]"
  SearchStr ":" "[_DIMS]" "[_CP]" "CaseSensitive"
  If "[_CP]" ">" "0"
    SubStr "[_DIMS]" "1" "[_CP]-1" "[NWID.CanvasW]"
    SubStr "[_DIMS]" "[_CP]+1" "[_NL]" "[NWID.CanvasH]"
  EndIf
  GoSub "_NWID_InitVars"
EndIf
SearchStr "NWID_PAGE_EXIT:" "[NWID.Msg]" "[_NP]" "CaseSensitive"
If "[_NP]" "=" "1"
  StrLen "[NWID.Msg]" "[_NL]"
  SubStr "[NWID.Msg]" "16" "[_NL]-15" "[_PP]"
  SearchStr "|" "[_PP]" "[_PS]" "CaseSensitive"
  If "[_PS]" ">" "0"
    SubStr "[_PP]" "1" "[_PS]-1" "[NWID.PageName]"
    SubStr "[_PP]" "[_PS]+1" "[_NL]" "[NWID.PageIndex]"
  EndIf
  GoSub "NWID_OnPageExit"
EndIf
SearchStr "NWID_PAGE_ENTER:" "[NWID.Msg]" "[_NP]" "CaseSensitive"
If "[_NP]" "=" "1"
  StrLen "[NWID.Msg]" "[_NL]"
  SubStr "[NWID.Msg]" "17" "[_NL]-16" "[_PP]"
  SearchStr "|" "[_PP]" "[_PS]" "CaseSensitive"
  If "[_PS]" ">" "0"
    SubStr "[_PP]" "1" "[_PS]-1" "[NWID.PageName]"
    SubStr "[_PP]" "[_PS]+1" "[_NL]" "[NWID.PageIndex]"
  EndIf
  GoSub "NWID_OnPageEnter"
EndIf
SearchStr "NWID_PAGE_CHANGED:" "[NWID.Msg]" "[_NP]" "CaseSensitive"
If "[_NP]" "=" "1"
  StrLen "[NWID.Msg]" "[_NL]"
  SubStr "[NWID.Msg]" "20" "[_NL]-19" "[_PP]"
  SearchStr "|" "[_PP]" "[_PS]" "CaseSensitive"
  If "[_PS]" ">" "0"
    SubStr "[_PP]" "1" "[_PS]-1" "[NWID.PageName]"
    SubStr "[_PP]" "[_PS]+1" "[_NL]" "[NWID.PageIndex]"
  EndIf
  GoSub "NWID_OnPageChanged"
EndIf
SearchStr "NWID_ERROR:" "[NWID.Msg]" "[_NP]" "CaseSensitive"
If "[_NP]" "=" "1"
  StrLen "[NWID.Msg]" "[_NL]"
  SubStr "[NWID.Msg]" "12" "[_NL]-11" "[NWID.ErrorMsg]"
  AlertBox "NWID Runtime Error" "[NWID.ErrorMsg]"
EndIf
Return

:_NWID_InitVars
. Internal — sets up per-control variables, then calls :NWID_OnReady
. [NWID.CanvasW] and [NWID.CanvasH] are set to the first page dimensions.
.
. Control name variables -- auto-generated from your layout.
. [ctrl_id.name]  = control ID string
. [ctrl_id.event] = name of the event that fired
. [ctrl_id.sub]   = primary event subroutine name
. [ctrl_id.prop]  = primary readable/writable property
. For tables: [ctrl_id.col1] [ctrl_id.col2] ... = auto-parsed row columns
. For tables: [ctrl_id.colCount] = number of columns in clicked row
.
. lbl_title  (label)
SetVar "[lbl_title.name]" "lbl_title"
SetVar "[lbl_title.sub]"  ""  . wire a Left_Click event to populate this
SetVar "[lbl_title.prop]" "caption"
SetVar "[lbl_title.propKey]" "caption"
. grp_form  (groupBox)
SetVar "[grp_form.name]" "grp_form"
SetVar "[grp_form.sub]"  ""  . wire a Left_Click event to populate this
SetVar "[grp_form.prop]" "caption"
SetVar "[grp_form.propKey]" "caption"
. txt_fecha  (textInput)
SetVar "[txt_fecha.name]" "txt_fecha"
SetVar "[txt_fecha.sub]"  ""  . wire a Value_Changed event to populate this
SetVar "[txt_fecha.prop]" "value"
SetVar "[txt_fecha.propKey]" "value"
. txt_detalle  (textInput)
SetVar "[txt_detalle.name]" "txt_detalle"
SetVar "[txt_detalle.sub]"  ""  . wire a Value_Changed event to populate this
SetVar "[txt_detalle.prop]" "value"
SetVar "[txt_detalle.propKey]" "value"
. txt_compartido  (textInput)
SetVar "[txt_compartido.name]" "txt_compartido"
SetVar "[txt_compartido.sub]"  ""  . wire a Value_Changed event to populate this
SetVar "[txt_compartido.prop]" "value"
SetVar "[txt_compartido.propKey]" "value"
. txt_personal  (textInput)
SetVar "[txt_personal.name]" "txt_personal"
SetVar "[txt_personal.sub]"  ""  . wire a Value_Changed event to populate this
SetVar "[txt_personal.prop]" "value"
SetVar "[txt_personal.propKey]" "value"
. btn_agregar  (button)
SetVar "[btn_agregar.name]" "btn_agregar"
SetVar "[btn_agregar.sub]"  "OnAgregarGasto"
SetVar "[btn_agregar.prop]" "caption"
SetVar "[btn_agregar.propKey]" "caption"
. btn_calcular  (button)
SetVar "[btn_calcular.name]" "btn_calcular"
SetVar "[btn_calcular.sub]"  "OnCalcularGastos"
SetVar "[btn_calcular.prop]" "caption"
SetVar "[btn_calcular.propKey]" "caption"
. tbl_gastos  (table)
SetVar "[tbl_gastos.name]" "tbl_gastos"
SetVar "[tbl_gastos.sub]"  ""  . wire a Row_Click event to populate this
SetVar "[tbl_gastos.prop]" "row"
SetVar "[tbl_gastos.propKey]" "row"
. lbl_total_compartido  (label)
SetVar "[lbl_total_compartido.name]" "lbl_total_compartido"
SetVar "[lbl_total_compartido.sub]"  ""  . wire a Left_Click event to populate this
SetVar "[lbl_total_compartido.prop]" "caption"
SetVar "[lbl_total_compartido.propKey]" "caption"
. lbl_total_personal  (label)
SetVar "[lbl_total_personal.name]" "lbl_total_personal"
SetVar "[lbl_total_personal.sub]"  ""  . wire a Left_Click event to populate this
SetVar "[lbl_total_personal.prop]" "caption"
SetVar "[lbl_total_personal.propKey]" "caption"
. lbl_parte1  (label)
SetVar "[lbl_parte1.name]" "lbl_parte1"
SetVar "[lbl_parte1.sub]"  ""  . wire a Left_Click event to populate this
SetVar "[lbl_parte1.prop]" "caption"
SetVar "[lbl_parte1.propKey]" "caption"
. lbl_parte2  (label)
SetVar "[lbl_parte2.name]" "lbl_parte2"
SetVar "[lbl_parte2.sub]"  ""  . wire a Left_Click event to populate this
SetVar "[lbl_parte2.prop]" "caption"
SetVar "[lbl_parte2.propKey]" "caption"
. lbl_final  (label)
SetVar "[lbl_final.name]" "lbl_final"
SetVar "[lbl_final.sub]"  ""  . wire a Left_Click event to populate this
SetVar "[lbl_final.prop]" "caption"
SetVar "[lbl_final.propKey]" "caption"
.
. Page variables -- auto-generated from your layout.
. [PageName.name]   = page name string
. [PageName.width]  = canvas width in pixels
. [PageName.height] = canvas height in pixels
. [PageName.index]  = zero-based page index
. [PageName.mode]   = "center" / "fill" / "custom"
.
. Main  (page 0: Main)
SetVar "[Main.name]"   "Main"
SetVar "[Main.width]"  "1024"
SetVar "[Main.height]" "768"
SetVar "[Main.index]"  "0"
SetVar "[Main.mode]"   "center"
SetVar "[NWID.PageCount]" "1"
GoSub "NWID_OnReady"
Return


:NWID_OnPageExit
. Fires just before leaving a page.
. [NWID.PageName]  = name of the page being left
. [NWID.PageIndex] = 0-based index of the page being left
If "[NWID.PageName]" "=" "Main"
  GoSub "Main_OnExit"
EndIf
Return

:NWID_OnPageEnter
. Fires when arriving on a page.
. [NWID.PageName]  = name of the page just entered
. [NWID.PageIndex] = 0-based index of the page just entered
If "[NWID.PageName]" "=" "Main"
  GoSub "Main_OnEnter"
EndIf
Return

.============================================================
.  NWID MACROS -- Do not edit
.============================================================

:SetProp
. Generic property setter — uses per-control variable names.
. Usage:
.   SetVar "[btn_go.caption]" "My new caption!"
.   SetVar "[SetObjectProperty]" "btn_go.caption"
.   GoSub "SetProp"
SearchStr "." "[SetObjectProperty]" "[_SPDot]" "CaseSensitive"
If "[_SPDot]" ">" "0"
  SubStr "[SetObjectProperty]" "1" "[_SPDot]-1" "[NWID.TargetId]"
  StrLen "[SetObjectProperty]" "[_SPLen]"
  SubStr "[SetObjectProperty]" "[_SPDot]+1" "[_SPLen]" "[NWID.SetPropName]"
  SetVar "[NWID.SetPropValue]" "[[SetObjectProperty]]"
  GoSub "NWID_SetProp"
EndIf
Return

:NWID_SetProp
. Low-level property setter (used by :SetProp internally).
. [NWID.TargetId]     = control id
. [NWID.SetPropName]  = property name
. [NWID.SetPropValue] = value
StrReplace "[NWID.SetPropValue]" "'" "\\'" "[_SafeVal]" ""
ezEdgeExecScript "[NWID.Rect]" "window.NWID.setProp('[NWID.TargetId]','[NWID.SetPropName]','[_SafeVal]');" "" "[NWID.ExecResult]"
Return

:NWID_GetProp
. Get a control property -- response fires NWID_OnPropValue.
. [NWID.TargetId]    = control id
. [NWID.GetPropName] = property name
ezEdgeExecScript "[NWID.Rect]" "window.NWID.getProp('[NWID.TargetId]','[NWID.GetPropName]');" "" "[NWID.ExecResult]"
Return

:NWID_GetPropSync
. Read a property IMMEDIATELY -- result goes straight into a variable.
. No callback needed. Much simpler than NWID_GetProp for most uses.
. [NWID.TargetId]    = control id
. [NWID.GetPropName] = property name
. [NWID.PropResult]  = receives the value
ezEdgeExecScript "[NWID.Rect]" "window.NWID.getPropSync('[NWID.TargetId]','[NWID.GetPropName]');" "[NWID.PropResult]" "[NWID.ExecResult]"
Return

:NWID_Show
SetVar "[NWID.SetPropName]" "visible"
SetVar "[NWID.SetPropValue]" "true"
GoSub "NWID_SetProp"
Return

:NWID_Hide
SetVar "[NWID.SetPropName]" "visible"
SetVar "[NWID.SetPropValue]" "false"
GoSub "NWID_SetProp"
Return

:NWID_Enable
SetVar "[NWID.SetPropName]" "enabled"
SetVar "[NWID.SetPropValue]" "true"
GoSub "NWID_SetProp"
Return

:NWID_Disable
SetVar "[NWID.SetPropName]" "enabled"
SetVar "[NWID.SetPropValue]" "false"
GoSub "NWID_SetProp"
Return

:NWID_SetFocus
. Set keyboard focus to a control.
. [NWID.TargetId] = control ID
ezEdgeExecScript "[NWID.Rect]" "window.NWID.setFocus('[NWID.TargetId]');" "" "[NWID.ExecResult]"
Return

:NWID_ShowPage
. Switch to a named or indexed page in the runtime.
. [NWID.SetPropValue] = page name or 0-based index
ezEdgeExecScript "[NWID.Rect]" "window.NWID.showPage('[NWID.SetPropValue]');" "" "[NWID.ExecResult]"
Return

:NWID_NextPage
. Advance to the next page (wraps around).
ezEdgeExecScript "[NWID.Rect]" "window.NWID.nextPage();" "" "[NWID.ExecResult]"
Return

:NWID_PrevPage
. Go back to the previous page (wraps around).
ezEdgeExecScript "[NWID.Rect]" "window.NWID.prevPage();" "" "[NWID.ExecResult]"
Return

:NWID_LoadFile
. Load an HTML file into the runtime rectangle.
. [NWID.Rect]     = rectangle name (already set)
. [NWID.LoadPath] = full path to HTML file
ezEdgeGoTo "[NWID.Rect]" "[NWID.LoadPath]" "[Result]"
Return

:OnAppExit
. Kill all JS timers and silence the bridge before teardown
ezEdgeExecScript "[NWID.Rect]" "if(window.NWID_shutdown)window.NWID_shutdown();" "" "[NWID.ExecResult]"
Delay "300"
ezEdgeGoTo "[NWID.Rect]" "about:blank" "[Result]"
Delay "500"
ezEdgeDeleteCache "[NWID.Rect]" "[TempDir]NWIDCache" "[Result]"
ezEdgeDelete "[NWID.Rect]" "[Result]"
Delay "200"
Exit "" ""
Return


.============================================================
.  CONTROL-SPECIFIC HELPERS (auto-generated -- do not edit)
.  These are convenience wrappers for your layout controls.
.============================================================

.------------------------------------------------------------
. lbl_title  (label)
.------------------------------------------------------------
:Set_lbl_title
. Set caption text on lbl_title
. Preferred: SetVar "[lbl_title.caption]" "your value"
.            SetVar "[SetObjectProperty]" "lbl_title.caption"
.            GoSub "SetProp"
. Legacy:    SetVar "[NWID.SetPropValue]" "your value"
.            GoSub "Set_lbl_title"
SetVar "[NWID.TargetId]" "lbl_title"
SetVar "[NWID.SetPropName]" "caption"
GoSub "NWID_SetProp"
Return

:Show_lbl_title
. Show lbl_title
SetVar "[NWID.TargetId]" "lbl_title"
GoSub "NWID_Show"
Return

:Hide_lbl_title
. Hide lbl_title
SetVar "[NWID.TargetId]" "lbl_title"
GoSub "NWID_Hide"
Return

:Get_lbl_title
. Read caption text from lbl_title into [NWID.PropResult].
. No callback -- value is available immediately after GoSub returns.
SetVar "[NWID.TargetId]" "lbl_title"
SetVar "[NWID.GetPropName]" "caption"
GoSub "NWID_GetPropSync"
. [NWID.PropResult] now contains the value
Return

.------------------------------------------------------------
. grp_form  (groupBox)
.------------------------------------------------------------
:Set_grp_form
. Set caption text on grp_form
. Preferred: SetVar "[grp_form.caption]" "your value"
.            SetVar "[SetObjectProperty]" "grp_form.caption"
.            GoSub "SetProp"
. Legacy:    SetVar "[NWID.SetPropValue]" "your value"
.            GoSub "Set_grp_form"
SetVar "[NWID.TargetId]" "grp_form"
SetVar "[NWID.SetPropName]" "caption"
GoSub "NWID_SetProp"
Return

:Show_grp_form
. Show grp_form
SetVar "[NWID.TargetId]" "grp_form"
GoSub "NWID_Show"
Return

:Hide_grp_form
. Hide grp_form
SetVar "[NWID.TargetId]" "grp_form"
GoSub "NWID_Hide"
Return

:Get_grp_form
. Read caption text from grp_form into [NWID.PropResult].
. No callback -- value is available immediately after GoSub returns.
SetVar "[NWID.TargetId]" "grp_form"
SetVar "[NWID.GetPropName]" "caption"
GoSub "NWID_GetPropSync"
. [NWID.PropResult] now contains the value
Return

.------------------------------------------------------------
. txt_fecha  (textInput)
.------------------------------------------------------------
:Set_txt_fecha
. Set text value on txt_fecha
. Preferred: SetVar "[txt_fecha.value]" "your value"
.            SetVar "[SetObjectProperty]" "txt_fecha.value"
.            GoSub "SetProp"
. Legacy:    SetVar "[NWID.SetPropValue]" "your value"
.            GoSub "Set_txt_fecha"
SetVar "[NWID.TargetId]" "txt_fecha"
SetVar "[NWID.SetPropName]" "value"
GoSub "NWID_SetProp"
Return

:Show_txt_fecha
. Show txt_fecha
SetVar "[NWID.TargetId]" "txt_fecha"
GoSub "NWID_Show"
Return

:Hide_txt_fecha
. Hide txt_fecha
SetVar "[NWID.TargetId]" "txt_fecha"
GoSub "NWID_Hide"
Return

:Focus_txt_fecha
. Set focus to txt_fecha
SetVar "[NWID.TargetId]" "txt_fecha"
GoSub "NWID_SetFocus"
Return

:Get_txt_fecha
. Read text value from txt_fecha into [NWID.PropResult].
. No callback -- value is available immediately after GoSub returns.
SetVar "[NWID.TargetId]" "txt_fecha"
SetVar "[NWID.GetPropName]" "value"
GoSub "NWID_GetPropSync"
. [NWID.PropResult] now contains the value
Return

.------------------------------------------------------------
. txt_detalle  (textInput)
.------------------------------------------------------------
:Set_txt_detalle
. Set text value on txt_detalle
. Preferred: SetVar "[txt_detalle.value]" "your value"
.            SetVar "[SetObjectProperty]" "txt_detalle.value"
.            GoSub "SetProp"
. Legacy:    SetVar "[NWID.SetPropValue]" "your value"
.            GoSub "Set_txt_detalle"
SetVar "[NWID.TargetId]" "txt_detalle"
SetVar "[NWID.SetPropName]" "value"
GoSub "NWID_SetProp"
Return

:Show_txt_detalle
. Show txt_detalle
SetVar "[NWID.TargetId]" "txt_detalle"
GoSub "NWID_Show"
Return

:Hide_txt_detalle
. Hide txt_detalle
SetVar "[NWID.TargetId]" "txt_detalle"
GoSub "NWID_Hide"
Return

:Focus_txt_detalle
. Set focus to txt_detalle
SetVar "[NWID.TargetId]" "txt_detalle"
GoSub "NWID_SetFocus"
Return

:Get_txt_detalle
. Read text value from txt_detalle into [NWID.PropResult].
. No callback -- value is available immediately after GoSub returns.
SetVar "[NWID.TargetId]" "txt_detalle"
SetVar "[NWID.GetPropName]" "value"
GoSub "NWID_GetPropSync"
. [NWID.PropResult] now contains the value
Return

.------------------------------------------------------------
. txt_compartido  (textInput)
.------------------------------------------------------------
:Set_txt_compartido
. Set text value on txt_compartido
. Preferred: SetVar "[txt_compartido.value]" "your value"
.            SetVar "[SetObjectProperty]" "txt_compartido.value"
.            GoSub "SetProp"
. Legacy:    SetVar "[NWID.SetPropValue]" "your value"
.            GoSub "Set_txt_compartido"
SetVar "[NWID.TargetId]" "txt_compartido"
SetVar "[NWID.SetPropName]" "value"
GoSub "NWID_SetProp"
Return

:Show_txt_compartido
. Show txt_compartido
SetVar "[NWID.TargetId]" "txt_compartido"
GoSub "NWID_Show"
Return

:Hide_txt_compartido
. Hide txt_compartido
SetVar "[NWID.TargetId]" "txt_compartido"
GoSub "NWID_Hide"
Return

:Focus_txt_compartido
. Set focus to txt_compartido
SetVar "[NWID.TargetId]" "txt_compartido"
GoSub "NWID_SetFocus"
Return

:Get_txt_compartido
. Read text value from txt_compartido into [NWID.PropResult].
. No callback -- value is available immediately after GoSub returns.
SetVar "[NWID.TargetId]" "txt_compartido"
SetVar "[NWID.GetPropName]" "value"
GoSub "NWID_GetPropSync"
. [NWID.PropResult] now contains the value
Return

.------------------------------------------------------------
. txt_personal  (textInput)
.------------------------------------------------------------
:Set_txt_personal
. Set text value on txt_personal
. Preferred: SetVar "[txt_personal.value]" "your value"
.            SetVar "[SetObjectProperty]" "txt_personal.value"
.            GoSub "SetProp"
. Legacy:    SetVar "[NWID.SetPropValue]" "your value"
.            GoSub "Set_txt_personal"
SetVar "[NWID.TargetId]" "txt_personal"
SetVar "[NWID.SetPropName]" "value"
GoSub "NWID_SetProp"
Return

:Show_txt_personal
. Show txt_personal
SetVar "[NWID.TargetId]" "txt_personal"
GoSub "NWID_Show"
Return

:Hide_txt_personal
. Hide txt_personal
SetVar "[NWID.TargetId]" "txt_personal"
GoSub "NWID_Hide"
Return

:Focus_txt_personal
. Set focus to txt_personal
SetVar "[NWID.TargetId]" "txt_personal"
GoSub "NWID_SetFocus"
Return

:Get_txt_personal
. Read text value from txt_personal into [NWID.PropResult].
. No callback -- value is available immediately after GoSub returns.
SetVar "[NWID.TargetId]" "txt_personal"
SetVar "[NWID.GetPropName]" "value"
GoSub "NWID_GetPropSync"
. [NWID.PropResult] now contains the value
Return

.------------------------------------------------------------
. btn_agregar  (button)
.------------------------------------------------------------
:Set_btn_agregar
. Set caption text on btn_agregar
. Preferred: SetVar "[btn_agregar.caption]" "your value"
.            SetVar "[SetObjectProperty]" "btn_agregar.caption"
.            GoSub "SetProp"
. Legacy:    SetVar "[NWID.SetPropValue]" "your value"
.            GoSub "Set_btn_agregar"
SetVar "[NWID.TargetId]" "btn_agregar"
SetVar "[NWID.SetPropName]" "caption"
GoSub "NWID_SetProp"
Return

:Show_btn_agregar
. Show btn_agregar
SetVar "[NWID.TargetId]" "btn_agregar"
GoSub "NWID_Show"
Return

:Hide_btn_agregar
. Hide btn_agregar
SetVar "[NWID.TargetId]" "btn_agregar"
GoSub "NWID_Hide"
Return

:Get_btn_agregar
. Read caption text from btn_agregar into [NWID.PropResult].
. No callback -- value is available immediately after GoSub returns.
SetVar "[NWID.TargetId]" "btn_agregar"
SetVar "[NWID.GetPropName]" "caption"
GoSub "NWID_GetPropSync"
. [NWID.PropResult] now contains the value
Return

.------------------------------------------------------------
. btn_calcular  (button)
.------------------------------------------------------------
:Set_btn_calcular
. Set caption text on btn_calcular
. Preferred: SetVar "[btn_calcular.caption]" "your value"
.            SetVar "[SetObjectProperty]" "btn_calcular.caption"
.            GoSub "SetProp"
. Legacy:    SetVar "[NWID.SetPropValue]" "your value"
.            GoSub "Set_btn_calcular"
SetVar "[NWID.TargetId]" "btn_calcular"
SetVar "[NWID.SetPropName]" "caption"
GoSub "NWID_SetProp"
Return

:Show_btn_calcular
. Show btn_calcular
SetVar "[NWID.TargetId]" "btn_calcular"
GoSub "NWID_Show"
Return

:Hide_btn_calcular
. Hide btn_calcular
SetVar "[NWID.TargetId]" "btn_calcular"
GoSub "NWID_Hide"
Return

:Get_btn_calcular
. Read caption text from btn_calcular into [NWID.PropResult].
. No callback -- value is available immediately after GoSub returns.
SetVar "[NWID.TargetId]" "btn_calcular"
SetVar "[NWID.GetPropName]" "caption"
GoSub "NWID_GetPropSync"
. [NWID.PropResult] now contains the value
Return

.------------------------------------------------------------
. tbl_gastos  (table)
.------------------------------------------------------------
:Set_tbl_gastos
. Set clicked row index on tbl_gastos
. Preferred: SetVar "[tbl_gastos.row]" "your value"
.            SetVar "[SetObjectProperty]" "tbl_gastos.row"
.            GoSub "SetProp"
. Legacy:    SetVar "[NWID.SetPropValue]" "your value"
.            GoSub "Set_tbl_gastos"
SetVar "[NWID.TargetId]" "tbl_gastos"
SetVar "[NWID.SetPropName]" "row"
GoSub "NWID_SetProp"
Return

:Show_tbl_gastos
. Show tbl_gastos
SetVar "[NWID.TargetId]" "tbl_gastos"
GoSub "NWID_Show"
Return

:Hide_tbl_gastos
. Hide tbl_gastos
SetVar "[NWID.TargetId]" "tbl_gastos"
GoSub "NWID_Hide"
Return

:Get_tbl_gastos
. Read clicked row index from tbl_gastos into [NWID.PropResult].
. No callback -- value is available immediately after GoSub returns.
SetVar "[NWID.TargetId]" "tbl_gastos"
SetVar "[NWID.GetPropName]" "row"
GoSub "NWID_GetPropSync"
. [NWID.PropResult] now contains the value
Return

.------------------------------------------------------------
. lbl_total_compartido  (label)
.------------------------------------------------------------
:Set_lbl_total_compartido
. Set caption text on lbl_total_compartido
. Preferred: SetVar "[lbl_total_compartido.caption]" "your value"
.            SetVar "[SetObjectProperty]" "lbl_total_compartido.caption"
.            GoSub "SetProp"
. Legacy:    SetVar "[NWID.SetPropValue]" "your value"
.            GoSub "Set_lbl_total_compartido"
SetVar "[NWID.TargetId]" "lbl_total_compartido"
SetVar "[NWID.SetPropName]" "caption"
GoSub "NWID_SetProp"
Return

:Show_lbl_total_compartido
. Show lbl_total_compartido
SetVar "[NWID.TargetId]" "lbl_total_compartido"
GoSub "NWID_Show"
Return

:Hide_lbl_total_compartido
. Hide lbl_total_compartido
SetVar "[NWID.TargetId]" "lbl_total_compartido"
GoSub "NWID_Hide"
Return

:Get_lbl_total_compartido
. Read caption text from lbl_total_compartido into [NWID.PropResult].
. No callback -- value is available immediately after GoSub returns.
SetVar "[NWID.TargetId]" "lbl_total_compartido"
SetVar "[NWID.GetPropName]" "caption"
GoSub "NWID_GetPropSync"
. [NWID.PropResult] now contains the value
Return

.------------------------------------------------------------
. lbl_total_personal  (label)
.------------------------------------------------------------
:Set_lbl_total_personal
. Set caption text on lbl_total_personal
. Preferred: SetVar "[lbl_total_personal.caption]" "your value"
.            SetVar "[SetObjectProperty]" "lbl_total_personal.caption"
.            GoSub "SetProp"
. Legacy:    SetVar "[NWID.SetPropValue]" "your value"
.            GoSub "Set_lbl_total_personal"
SetVar "[NWID.TargetId]" "lbl_total_personal"
SetVar "[NWID.SetPropName]" "caption"
GoSub "NWID_SetProp"
Return

:Show_lbl_total_personal
. Show lbl_total_personal
SetVar "[NWID.TargetId]" "lbl_total_personal"
GoSub "NWID_Show"
Return

:Hide_lbl_total_personal
. Hide lbl_total_personal
SetVar "[NWID.TargetId]" "lbl_total_personal"
GoSub "NWID_Hide"
Return

:Get_lbl_total_personal
. Read caption text from lbl_total_personal into [NWID.PropResult].
. No callback -- value is available immediately after GoSub returns.
SetVar "[NWID.TargetId]" "lbl_total_personal"
SetVar "[NWID.GetPropName]" "caption"
GoSub "NWID_GetPropSync"
. [NWID.PropResult] now contains the value
Return

.------------------------------------------------------------
. lbl_parte1  (label)
.------------------------------------------------------------
:Set_lbl_parte1
. Set caption text on lbl_parte1
. Preferred: SetVar "[lbl_parte1.caption]" "your value"
.            SetVar "[SetObjectProperty]" "lbl_parte1.caption"
.            GoSub "SetProp"
. Legacy:    SetVar "[NWID.SetPropValue]" "your value"
.            GoSub "Set_lbl_parte1"
SetVar "[NWID.TargetId]" "lbl_parte1"
SetVar "[NWID.SetPropName]" "caption"
GoSub "NWID_SetProp"
Return

:Show_lbl_parte1
. Show lbl_parte1
SetVar "[NWID.TargetId]" "lbl_parte1"
GoSub "NWID_Show"
Return

:Hide_lbl_parte1
. Hide lbl_parte1
SetVar "[NWID.TargetId]" "lbl_parte1"
GoSub "NWID_Hide"
Return

:Get_lbl_parte1
. Read caption text from lbl_parte1 into [NWID.PropResult].
. No callback -- value is available immediately after GoSub returns.
SetVar "[NWID.TargetId]" "lbl_parte1"
SetVar "[NWID.GetPropName]" "caption"
GoSub "NWID_GetPropSync"
. [NWID.PropResult] now contains the value
Return

.------------------------------------------------------------
. lbl_parte2  (label)
.------------------------------------------------------------
:Set_lbl_parte2
. Set caption text on lbl_parte2
. Preferred: SetVar "[lbl_parte2.caption]" "your value"
.            SetVar "[SetObjectProperty]" "lbl_parte2.caption"
.            GoSub "SetProp"
. Legacy:    SetVar "[NWID.SetPropValue]" "your value"
.            GoSub "Set_lbl_parte2"
SetVar "[NWID.TargetId]" "lbl_parte2"
SetVar "[NWID.SetPropName]" "caption"
GoSub "NWID_SetProp"
Return

:Show_lbl_parte2
. Show lbl_parte2
SetVar "[NWID.TargetId]" "lbl_parte2"
GoSub "NWID_Show"
Return

:Hide_lbl_parte2
. Hide lbl_parte2
SetVar "[NWID.TargetId]" "lbl_parte2"
GoSub "NWID_Hide"
Return

:Get_lbl_parte2
. Read caption text from lbl_parte2 into [NWID.PropResult].
. No callback -- value is available immediately after GoSub returns.
SetVar "[NWID.TargetId]" "lbl_parte2"
SetVar "[NWID.GetPropName]" "caption"
GoSub "NWID_GetPropSync"
. [NWID.PropResult] now contains the value
Return

.------------------------------------------------------------
. lbl_final  (label)
.------------------------------------------------------------
:Set_lbl_final
. Set caption text on lbl_final
. Preferred: SetVar "[lbl_final.caption]" "your value"
.            SetVar "[SetObjectProperty]" "lbl_final.caption"
.            GoSub "SetProp"
. Legacy:    SetVar "[NWID.SetPropValue]" "your value"
.            GoSub "Set_lbl_final"
SetVar "[NWID.TargetId]" "lbl_final"
SetVar "[NWID.SetPropName]" "caption"
GoSub "NWID_SetProp"
Return

:Show_lbl_final
. Show lbl_final
SetVar "[NWID.TargetId]" "lbl_final"
GoSub "NWID_Show"
Return

:Hide_lbl_final
. Hide lbl_final
SetVar "[NWID.TargetId]" "lbl_final"
GoSub "NWID_Hide"
Return

:Get_lbl_final
. Read caption text from lbl_final into [NWID.PropResult].
. No callback -- value is available immediately after GoSub returns.
SetVar "[NWID.TargetId]" "lbl_final"
SetVar "[NWID.GetPropName]" "caption"
GoSub "NWID_GetPropSync"
. [NWID.PropResult] now contains the value
Return
