Add testing-callback to textbox entry
This commit is contained in:
parent
ce486ef5f6
commit
0259e06b99
30
contact.scm
30
contact.scm
|
@ -14,6 +14,7 @@
|
|||
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
(import (chicken io)
|
||||
(chicken string)
|
||||
qt-light)
|
||||
|
||||
|
||||
|
@ -47,11 +48,36 @@
|
|||
|
||||
;; Connect callback functions to widgets’ signals.
|
||||
(define (window-callbacks window)
|
||||
(let ([file→exit (qt:find window "actionQuit")])
|
||||
(let* ([file→exit (qt:find window "actionQuit")])
|
||||
;; We connect to https://doc.qt.io/qt-6/qaction.html#triggered
|
||||
(if file→exit
|
||||
(qt:connect
|
||||
file→exit "triggered()"
|
||||
(qt:receiver exit)))))
|
||||
(qt:receiver exit))))
|
||||
(textbox-callbacks window))
|
||||
|
||||
|
||||
;; Connect a text-printing callback to each textbox.
|
||||
(define (textbox-callbacks window)
|
||||
(let* ([property-names
|
||||
'("address" "city" "company" "county" "eMail" "fax"
|
||||
"homePhone" "name" "nickname" "state" "url"
|
||||
"workPhone" "zip")]
|
||||
[textboxes
|
||||
;; The texbox widgets are all named like “countryLineEdit”.
|
||||
(map (lambda (property)
|
||||
(qt:find window (conc property "LineEdit")))
|
||||
property-names)])
|
||||
;; Cycle through each textbox, connecting them to a callback that prints
|
||||
;; their contents each time you type in text.
|
||||
(map (lambda (textbox)
|
||||
(if textbox
|
||||
;; We connect to https://doc.qt.io/qt-6/qlineedit.html#textChanged
|
||||
;; … and print the value of https://doc.qt.io/qt-6/qlineedit.html#text-prop
|
||||
(qt:connect textbox "textChanged(QString)"
|
||||
(qt:receiver
|
||||
(lambda () (print (qt:property textbox "text")))))))
|
||||
textboxes)))
|
||||
|
||||
|
||||
(init)
|
||||
|
|
Ŝarĝante…
Reference in New Issue