09-15-2020, 06:36 AM | #1 |
Connoisseur
Posts: 93
Karma: 12
Join Date: Nov 2018
Location: Salamanca
Device: kobo Clara HD, Onyxboox C67
|
An unresolved programming issue
Hi,
I'm still looking for a way to call readerfooter.lua functions from dispatcher.lua (for example, call "onUpdaterFooter()" ). I want to update the footer so that the update appears immediately on the screen. Can someone help me and tell me how to do it? Thank you. |
09-15-2020, 06:49 AM | #2 |
cosiñeiro
Posts: 1,271
Karma: 2200049
Join Date: Apr 2014
Device: BQ Cervantes 4
|
Instead of calling a function yourself you emit a new event that is handled by the reader footer. See http://koreader.rocks/doc/topics/Events.md.html
|
Advert | |
|
09-15-2020, 07:33 AM | #3 |
Connoisseur
Posts: 93
Karma: 12
Join Date: Nov 2018
Location: Salamanca
Device: kobo Clara HD, Onyxboox C67
|
Thanks Pazos, but I don't understand "event" concept and how is its implementation. I don't know LUA. I have tried looking some LUA's files to use the same ideas, but I don't understand the concept. Can you tell me an example of event that is handled by the reader footer. Then I will try something similar.
|
09-15-2020, 07:55 AM | #4 |
BLAM!
Posts: 13,477
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
|
The extremely short-lived bit of code in #6648 could do just that. (Specifically, the commented out part, so, check the commit progression).
|
09-15-2020, 07:59 AM | #5 | |
cosiñeiro
Posts: 1,271
Karma: 2200049
Join Date: Apr 2014
Device: BQ Cervantes 4
|
Quote:
Instead of having to remember an instance of the object and its name to call the function you broadcast the event and each widget that can handle the event will react accordly to the event you broadcasted. Have a look at https://github.com/koreader/koreader...broadcastEvent. For a function called "onDoFoo" you broadcast a new event "DoFoo", and the event is delivered to all widgets and handled by widgets that implemented "onDoFoo" |
|
Advert | |
|
09-16-2020, 05:53 AM | #6 |
Connoisseur
Posts: 93
Karma: 12
Join Date: Nov 2018
Location: Salamanca
Device: kobo Clara HD, Onyxboox C67
|
I'm doing tests. Thanks to both of you.
|
09-16-2020, 07:12 AM | #7 |
Connoisseur
Posts: 93
Karma: 12
Join Date: Nov 2018
Location: Salamanca
Device: kobo Clara HD, Onyxboox C67
|
Gracias Pazos, he aprendido mucho con tus enlaces y sugerencias. Un camino nuevo que no conocía.
Thanks NiJule, I have learned a lot with your suggestions. This is what I needed and it works: UIManager:broadcastEvent(Event:new("UpdateFooter", true, true)) |
09-16-2020, 07:40 AM | #8 |
BLAM!
Posts: 13,477
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
|
Oh, duh, I'd forgotten that there already was an event handler for it ;p.
(Sidebar: you *probably* don't need the second true, unless you're doing some fairly wacky stuff ^^). |
09-16-2020, 08:18 AM | #9 |
Connoisseur
Posts: 93
Karma: 12
Join Date: Nov 2018
Location: Salamanca
Device: kobo Clara HD, Onyxboox C67
|
Effectively, the second 'true' is not necessary. All is 'ok' with one 'true'.
|
09-17-2020, 11:09 AM | #10 |
cosiñeiro
Posts: 1,271
Karma: 2200049
Join Date: Apr 2014
Device: BQ Cervantes 4
|
Happy to help @Carmelocotonto. Un saludo
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to get started with programming? | otanim | Lounge | 5 | 11-28-2017 06:53 AM |
Marvin 3 EPUB rendering bugs unresolved | cedhax | Marvin | 1 | 02-21-2017 06:34 PM |
KindleGen unresolved hyperlinks? | Fluor | Kindle Formats | 5 | 09-13-2013 03:20 PM |
Kobo Account Problems Remain Unresolved | exiga | Kobo Reader | 8 | 01-26-2013 05:50 PM |
eBooks unresolved | Ashutosh Pandey | Introduce Yourself | 4 | 05-27-2010 03:59 AM |