Skip to content

Comments

add "getClickType" method#5

Open
sakura-he wants to merge 1 commit intoLoganTraceur:masterfrom
sakura-he:master
Open

add "getClickType" method#5
sakura-he wants to merge 1 commit intoLoganTraceur:masterfrom
sakura-he:master

Conversation

@sakura-he
Copy link

Thank you very much for the button library you wrote, he helped me a lot, but I found a problem in using it. There are too many callback functions added for button events, so I modified the library and added a new method to it. After this method is called, it will return the type of key trigger, so, we can add the same function for all key events, and then determine the type of event in the function to react, so that there is no need to write different event functions for different event types. Off,
Sorry my English is not very good :) From google translation
befor:befor1.png befor2.png
after:after1.png after2.png

@LoganTraceur
Copy link
Owner

LoganTraceur commented Jul 2, 2020

Hi sakura-he,
It's my pleasure I am glad you are enjoying it.
In response to your suggestion, why are a large number of callbacks a problem?

I love seeing you modifying really getting into the library. Out of interest why is a large number of callbacks a problem?
I see how your single callback with a switch statement is similar for setup, but I wanted to know if you had any other reasons.

Cheers
Logan

@sakura-he
Copy link
Author

sakura-he commented Jul 2, 2020

Hi sakura-he,
It's my pleasure I am glad you are enjoying it.
In response to your suggestion, why are a large number of callbacks a problem?

I love seeing you modifying really getting into the library. Out of interest why is a large number of callbacks a problem?
I see how your single callback with a switch statement is similar for setup, but I wanted to know if you had any other reasons.

Cheers
Logan

Multiple callbacks in my program need to read the same static variable, but I don't want to write local static variables to global variables. Because it causes too many global variables to be detrimental to the maintainability of your program, So I changed your Shared library. Make callback functions for multiple button events share the same callback function so they can access common static variables in the function

@sakura-he
Copy link
Author

sakura-he commented Jul 2, 2020

Hi sakura-he,
It's my pleasure I am glad you are enjoying it.
In response to your suggestion, why are a large number of callbacks a problem?

I love seeing you modifying really getting into the library. Out of interest why is a large number of callbacks a problem?
I see how your single callback with a switch statement is similar for setup, but I wanted to know if you had any other reasons.

Cheers
Logan
2020-07-02-214224.png
This is part of my code snippet. after i modified the content in your shared library. I can simply do this

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

Successfully merging this pull request may close these issues.

2 participants