From: Donal F. <don...@ma...> - 2024-07-20 12:01:33
|
High level: Key presses enter Tk as KeyEvents (or the equivalent on other platforms). Those events are routed to the widget that has the focus (unlike many other events which go to the widget that has the mouse over it or which are just delivered to the target window). Upon delivery to a widget, events are mostly processed by a binding table (the thing that [bind] and [bindtags] manipulate) to work out what script to dispatch to; this is *always* the case for key events (some other events are handled separately). The table resolves things to a sequence of scripts, one for each relevant binding tag; the relevant ones for a key event on a ttk::entry are typically the <Key> event on the TEntry class, but there are other bindings for some keys. The class binding calls a procedure that decides what to do (a common Tk pattern) and that’s usually call the insert method with the correct insertion location for entries. That updates the underlying model of the widget, and schedules a redisplay of the widget when the event loop goes idle; that delayed redisplay mechanism is critical to how Tk works and is why Tk has had good performance for decades. (Idle means “no events pending from the event sources, would otherwise ask the OS to let us sleep to wait efficiently”.) The actual redisplay code does the obvious thing, using double buffering, repainting using standard drawing functions. Comparatively obvious stuff if you’ve ever done any GUI programming at all. Summary: high level Controllers are in Tcl scripts, Model is simple (typically just a string in a variable for entries) with some manipulator methods, and the View is done on a delayed basis. Donal. From: Jan Mercl <0x...@gm...> Sent: Friday, July 19, 2024 12:14 PM To: tcl...@li... Subject: [TCLCORE] Go port Hi list. I'm looking for help. I started a Tcl/Tk port for the Go programming language. (The C code is transpilled to Go, making cross compilation of Go programs using the package easier. ) Some things already work, many other do not yet. Additionally ZjQcmQRYFpfptBannerStart This Message Is From a New External Sender You have not previously corresponded with this sender. Please exercise caution when opening links or attachments included in this message. ZjQcmQRYFpfptBannerEnd Hi list. I'm looking for help. I started a Tcl/Tk port for the Go programming language. (The C code is transpilled to Go, making cross compilation of Go programs using the package easier.) Some things already work, many other do not yet. Additionally I'm making https://urldefense.com/v3/__https://pkg.go.dev/modernc.org/tk8.6__;!!PDiH4ENfjr2_Jw!BJn92uxN3omZowdJJBDQBI63EVsnJASDgsFBsyAtOWxLxH5bqxIm83o2VslMWwhtnnmnGNtWZAeMhvzwTtWH3vS8G0w$<https://urldefense.com/v3/__https:/pkg.go.dev/modernc.org/tk8.6__;!!PDiH4ENfjr2_Jw!BJn92uxN3omZowdJJBDQBI63EVsnJASDgsFBsyAtOWxLxH5bqxIm83o2VslMWwhtnnmnGNtWZAeMhvzwTtWH3vS8G0w$>[pkg[.]go[.]dev], which is something like tkinter for Go. It is a work in progress, not even alfa stage yet. I ran into https://urldefense.com/v3/__https://gitlab.com/cznic/tk8.6/-/issues/1__;!!PDiH4ENfjr2_Jw!BJn92uxN3omZowdJJBDQBI63EVsnJASDgsFBsyAtOWxLxH5bqxIm83o2VslMWwhtnnmnGNtWZAeMhvzwTtWHMgG7Bq4$<https://urldefense.com/v3/__https:/gitlab.com/cznic/tk8.6/-/issues/1__;!!PDiH4ENfjr2_Jw!BJn92uxN3omZowdJJBDQBI63EVsnJASDgsFBsyAtOWxLxH5bqxIm83o2VslMWwhtnnmnGNtWZAeMhvzwTtWHMgG7Bq4$>[gitlab[.]com]. Unfortunately, my practical experiences using Tcl/Tk are almost non existing. What I'm looking for is a high-level overview of how the machinery on the path from a keyboard keypress to the character getting displayed in the entry/ttk::entry widget works in Tcl/Tk. In other words, where do I need to look in debugging the issue for checkpoints. So far I was able to find the window manager events handling, I think. Where are the [other] X events processed missed me on the initial attempts. I can perhaps figure it out by myself, but I guess some guidance can save me a lot of time learning what someone else can teach me quickly. Or please point me to some existing design document I failed to find. I was advised on the Tcl Slack #general channel to ask here. Thanks in advance for any hints/tips. -j _______________________________________________ Tcl-Core mailing list Tcl...@li...<mailto:Tcl...@li...> https://urldefense.com/v3/__https://lists.sourceforge.net/lists/listinfo/tcl-core__;!!PDiH4ENfjr2_Jw!BJn92uxN3omZowdJJBDQBI63EVsnJASDgsFBsyAtOWxLxH5bqxIm83o2VslMWwhtnnmnGNtWZAeMhvzwTtWHgaFE_Ug$<https://urldefense.com/v3/__https:/lists.sourceforge.net/lists/listinfo/tcl-core__;!!PDiH4ENfjr2_Jw!BJn92uxN3omZowdJJBDQBI63EVsnJASDgsFBsyAtOWxLxH5bqxIm83o2VslMWwhtnnmnGNtWZAeMhvzwTtWHgaFE_Ug$>[lists[.]sourceforge[.]net] |