Thanks.As far as I can tell, this would allow the user to create a limited number of box types.Without changing the FLTK itself, there's no way to allow user create arbitrary number of custom box types.
You can create lamba functions with captures which can then be converted into function pointers in modern C++ With those, you can have as many box types and label types as you like.:
--
You received this message because you are subscribed to a topic in the Google Groups "fltk.general" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/fltkgeneral/dOrkdXu8LYg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to fltkgeneral...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/e395fdb9-8b32-41e7-999b-07fac052518en%40googlegroups.com.
I don't understand, how it's supposed to work.In C++ only captureless lambdas can be converted into function pointers.The "hack" presented in the link works because you can control the places where the function is called from.I my case it's being called whenever FLTK decides to draw a box, which is out of my control, afaict.I still can't see how I could implement bindings to fully generic box drawibg without some kind of user data pointer or such.
On Monday, 4 April 2022 at 08:30:53 UTC+1 Piotr wrote:
The "hack" presented in the link works because you can control the places where the function is called from.I my case it's being called whenever FLTK decides to draw a box, which is out of my control, afaict.
I still can't see how I could implement bindings to fully generic box drawibg without some kind of user data pointer or such.
In some ways, it seems like you are asking for a capability for the Go port that fltk doesn't readily provide for the native port, in that the emphasis has always been on "fast 'n light", such that theming and ready overloading or replacement of box types was never something fltk was too concerned with.
--
You received this message because you are subscribed to a topic in the Google Groups "fltk.general" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/fltkgeneral/dOrkdXu8LYg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to fltkgeneral...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/fe72529d-7509-0a70-e637-540609dcc203%40online.de.
There's another point that should be considered carefully for such a thing like Go bindings. When you use Fl::scheme("any-scheme") all the standard boxtypes are overwritten (in the array of boxtype definitions) by the boxtypes of the selected scheme. This includes the function pointers and all boxtype attributes. It may not matter for additional boxtypes though (because they are not "known" to the schemes) but that's what happens for existing boxtypes of all FLTK schemes.
I'm not happy with this, but this is how FLTK "schemes" were implemented in the early days of FLTK. There's currently no way to change this although I was thinking about a better way for years. Maybe at some time in the future...