Home » U++ Library support » U++ Widgets - General questions or Mixed problems » Upp Widgets in a dll
Re: Upp Widgets in a dll [message #60550 is a reply to message #60549] |
Sat, 27 April 2024 12:17   |
Oblivion
Messages: 1227 Registered: August 2007
|
Senior Contributor |
|
|
Minor technical details -in this context- between global variables and singletons aside, you are in fact declaring the GUI widgets as global variables:
Quote:i overlooked that widgets can't be declared globally, so just correct the
line in DllCode from 'Array<Ctrl> ctrls' to 'Array<Ctrl> &ctrls=Single<Array<Ctrl>>()'.
This will open a can of worms, since their destruction time or order is still left rather undefined. Hence the assertion failure. You need to declare your widgets in a local scope. Singletons won't help you here. Your widgets should belong somewhere. (At least, you should first construct them in your main code)
IMO, you can use the dll as a widget factory & layout generator instead. (i.e you have the array of widgets (ctrls) in your main code and let the dll just create the right type of ctrls on request in that array (since Upp:Array allows polymorphism.)
Best regards,
Oblivion
Github page: https://github.com/ismail-yilmaz
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[Updated on: Sat, 27 April 2024 13:01] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Thu Sep 04 20:26:57 CEST 2025
Total time taken to generate the page: 0.00374 seconds
|