Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Today's Messages (on)  | Unanswered Messages (off)

Forum: U++ Widgets - General questions or Mixed problems
 Topic: 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 is currently offline  Oblivion
Messages: 1093
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


[Updated on: Sat, 27 April 2024 13:01]

Report message to a moderator




Current Time: Sat Apr 27 15:01:53 CEST 2024

Total time taken to generate the page: 0.02797 seconds