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
Home » Community » Newbie corner » Focus problem
Re: Focus problem [message #57817 is a reply to message #57812] Sun, 19 December 2021 14:31 Go to previous messageGo to previous message
Lance is currently offline  Lance
Messages: 656
Registered: March 2007
Contributor
1): Derive MyPanel from ImageCtrl to supply customized Paint and Key is the right thing to do, at the moment at least, unfortunately.

3): Overriding MyPanel::Close to delete this is unnecessary and considered bad practice (in this case at least).

By overriding MyPanel::Close in your way, you basically enforce that MyPanel object have be be allocated from heap. U++ doesn't prohibit you from allocating Ctrl derivatives from heap, but it's much more often we have its object contained and be allocated from stack(faster and less memory usage). Or it can even be global, static etc.

In your case, if you really want your object be allocated from heap, you can use U++ provided smart pointer One to manage it for you. See example in the next reply.

[Updated on: Sun, 19 December 2021 15:26]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to output variable values with time stamp in windows application
Next Topic: Clang linker error: no such file or directory
Goto Forum:
  


Current Time: Sun Aug 24 07:02:22 CEST 2025

Total time taken to generate the page: 0.05506 seconds