흠.. pharo 에서 질문 있습니다.

4 views
Skip to first unread message

peter yoo

unread,
Dec 15, 2013, 9:46:06 AM12/15/13
to smallt...@googlegroups.com
일단 StringMorph 에서 상속받아서 클래스를 하나 만들었구요.


만들어진 class 에 다음과같은 메서드를 만들어서 넣었습니다.

handlesKeyStroke: anEvent
    "key input code to self contents"

    | keyValue |
    keyValue := anEvent keyValue.
   
    "self contents: (keyValue printString)."
    (keyValue isNil)
        ifFalse: [self contents: 'zzz'.]


키보드에서 뭔가 input 이 들어오면 해당되는 instance 의 contents 가 'zzz' 로 바뀌는거죠.....

(물른 코드 내용을 보시면 알겠지만 keyValue 의 값을 display 하고 싶었지만 아직 smalltalk 에서 type casting 에 익숙하지 않아서... 실패했습니다)


여튼 아래와 같은 방식으로 한다음 키보드 입력을 해서 contents 의 값은 바뀝니다.

abcd := KeyTestMorph new.
abcd contents: '한글 참 힘드네!!!'
abcd openInWorld.


(뭐 다들 익숙하신 코드일거니깐요.

이렇게 했을때 값이 바뀐다면 디버거에서

"NonBooleanReceiver: proceed for truth" 라는 내용이 나와버립니다.


어느 부분 코드를 잘못짠걸까요.. 아시는분은 답변좀...T.T
Reply all
Reply to author
Forward
0 new messages