Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cursor on the text #41

Open
madatao opened this issue Jul 13, 2019 · 5 comments
Open

cursor on the text #41

madatao opened this issue Jul 13, 2019 · 5 comments

Comments

@madatao
Copy link

madatao commented Jul 13, 2019

(define CHAR-CANVAS%
(class canvas%
(define/override (on-char evt)
(let ((c (send evt get-key-code)) (dc(send this get-dc)))
(send dc clear)
(print c)
(cond
((equal? c 'release)(void))
((member c '( #\a #\i #\u #\e #\o #\q #\é #\x))
(begin(set! tampon-key (cons c tampon-key)) (send dc draw-text (cadr (member (list->string (reverse tampon-key)) alphabet )) 30 30)
(send R-k-text insert (cadr (member (list->string (reverse tampon-key)) alphabet ))) (set! tampon-key '())))
((equal? c #;)(begin(send R-k-text insert "。") (set! tampon-key '())))
((equal? c #,)(begin(send R-k-text insert "、") (set! tampon-key '())))
((equal? c #()(begin(send R-k-text insert "「") (set! tampon-key '())))
((equal? c #))(begin(send R-k-text insert " 」") (set! tampon-key '())))
((equal? c #&)(begin(send R-k-text insert "々") (set! tampon-key '())))
((not(member c '(#\b #\c #\d #\f #\g #\j #\k #\m #\n #\p #\r #\i #\h #\t #\s #\w #\y #\a #\e #\o #\z #\u)))(void))
((begin (set! tampon-key (cons c tampon-key))(print tampon-key))))
))

(super-new)))

It works very well (it is for writing in hiragana katakana and other characters)
I want to add to this same canvas
a feature which tells me the position of the cursor on a text

is it possible? if yes
what is the code to add?

(define/override (on-char evt)......

Or do I need a another canvas?
in this case what will be my code?

 (define/override (on-char evt)......

this in order to do something similar to a "RIKAICHAN"

@jbclements
Copy link
Owner

jbclements commented Jul 16, 2019 via email

@jbclements
Copy link
Owner

jbclements commented Jul 16, 2019 via email

@madatao
Copy link
Author

madatao commented Jul 16, 2019 via email

@madatao
Copy link
Author

madatao commented Jul 18, 2019 via email

@madatao
Copy link
Author

madatao commented Jul 19, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants