From: <and...@bl...> - 2025-03-24 13:24:09
|
Hi Dima Actually in our latest release V1.4.2 I have changed the implementation slightly. The argument to Fl_Valuator::format is now strictly wrapped as an output parameter in Python. As length, I simply used the prescribed 128bytes. I think this works at the moment but of course it is not a nice solution. As has been correctly remarked in the code snippet for the format method, the length really needed to be provided. In my opinion, the best solution would be if fltk would start to use standard containers, like std::string, this would alleviate a lot of memory related problems and would bring fltk into more modern times. What do you think? Best regards Andreas > Dima Kogan <di...@se...> hat am 23.03.2025 20:32 CET geschrieben: > > > Hello. > > We talked about this earlier, but there was no conclusion, and I'd like > to actually find an answer. > > fltk provides a method to customize the formatting of any valuator > widget by overriding the virtual Fl_Valuator::format() function: > > https://www.fltk.org/doc-1.4/classFl__Valuator.html#aff16a315d6c85c08b01df98ff976f6f9 > > This would need an override. And its output string is returned in the > char* argument. I believe this is currently impossible to do with swig. > You can override the function using a swig director, but the result will > always treat the char* argument as an input, not an output. If that's > wrong, it actually is possible, please tell me. > > If it is impossible, let's suggest an alternative to the upstream fltk > people. Their current format() API needs a fix anyway, since any char* > buffer should also have a buffer size to go with it. Upstream knows > this; look at the comments: > > https://github.com/fltk/fltk/blob/80c73b508c9ac5f3fb2d8cafafffebbf466ea042/src/Fl_Valuator.cxx#L168 > > Would a callback work better with swig? Would WE be happy with that? > > > _______________________________________________ > Pyfltk-user mailing list > Pyf...@li... > https://lists.sourceforge.net/lists/listinfo/pyfltk-user |