简体   繁体   中英

C++/Tk: How to create slider and receive its value updates?

So I look at C++/Tk for as a GUI library. I see "lots" of examples - 6 . I like its style but I do not see how to create a slider/trackbar. I want such a trackbar that on its value change to have my function called and tb value sent to it. How to do such thing with C++/Tk?

You want a scale widget (which should be enough that you can find it in the docs) and you need an extra callback function which takes no arguments, reads the current value from the scale, and dispatches to your real function. That extra callback function will be configured into the scale via -command , much as the existing examples for buttons in the docs show. Or you could roll the code to read the value from the scale into your main callback function; your call there…

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM