을 일으키는 원인이 무엇인지"말씀되지는 않습 context"에 오류가 이 스크립트를 사용해야 할까요?

StackOverflow https://stackoverflow.com//questions/23039878

  •  21-12-2019
  •  | 
  •  

문제

나는 다음과 같은 R3-GUI 스크립트:

Rebol [
    file: %context.reb
]

either exists? %r3-gui.r3 [do %r3-gui.r3][load-gui]

view [
    title "First Window"
    hgroup [
        lab: label "fld 1 "
        fld1: field "Field Data 1"
    ]
    button "Display fld 1" on-action [if error? try [probe get-face fld1][alert "Can't read fld1"]]
    button "Display fld 2" on-action [if error? try [probe get-face fld2][alert "Can't read fld2"]]
    button "Open 2nd Window" on-action [
        view [
            title "Second Window"
            hgroup [
                label "fld 2" fld2: field "field 2 data"
            ]
            button "Display fld1" on-action [if error? err: try [probe get-face fld1][probe err alert "Can't read fld1"]]
            button "Display fld2" on-action [if error? err: try [probe get-face fld2][probe err alert "Can't read fld2" ]]
        ]
    ]
]

When I click on"표시 fld2"버튼에서 2 번째 창의 콘텐츠에 액세스 fld2,나를 얻 ** Script error: fld2 word is not bound to a context 오류가 있습니다.의 원인은 무엇인 이?그리고 어떻게 액세스 fld2 말씀 안에 두 번째 창?

도움이 되었습니까?

해결책 2

문제가 발생하기 때문에 익명의 함수에 의해 생성되는 parse-layout 함수해야밈,그리고 그것은 아닙니다.보 diff 에 https://gist.github.com/earl/a009454787d9fe4cfaca 는 문제를 해결합니다.

다른 팁

FLD2는 익명의 기능에 대한 로컬이며 사용자 컨텍스트

에 바인딩되지 않기 때문에
>> help win-face/facets/tab-face/actors 
WIN-FACE/FACETS/TAB-FACE/ACTORS is a block of value: [on-action make function! [[face arg
        /local fld2 err
    ][
        view layout [
            title "Second Window"
            hgroup [
                label "fld 2" fld2: field "field 2 data"
            ]
            button "Display fld 1" on-action [if error? try [probe get-face fld1] [alert "Can't read fld1"]]
            button "Display fld2" on-action [if error? err: try [probe get-face fld2] [probe err alert "Can't read fld2"]]
        ]
    ]]]
>>
.

이렇게하면 작동합니다.

 l2: layout [
    title "Second Window"
    hgroup [
       label "fld 2" fld2: field "field 2 data"
    ]
    button "Display fld1" on-action [if error? err: try [probe get-face fld1][probe err alert "Can't read fld1"]]
    button "Display fld2" on-action [if error? err: try [probe get-face fld2][probe err alert "Can't read fld2" ]]
]


view  l1: layout [
   title "First Window"
   hgroup [
       lab: label "fld 1 "
       fld1: field "Field Data 1"
   ]
   button "Display fld 1" on-action [if error? try [probe get-face fld1][alert "Can't read fld1"]]
   button "Display fld 2" on-action [if error? try [probe get-face fld2][alert "Can't read fld2"]]
   button "Open 2nd Window" on-action [
      view l2
   ]
]
.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top