Home » Community » Newbie corner » Focus problem
Re: Focus problem [message #57817 is a reply to message #57812] |
Sun, 19 December 2021 14:31   |
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
|
|
|
 |
|
Focus problem
By: Silvan on Tue, 14 December 2021 21:23
|
 |
|
Re: Focus problem
By: Silvan on Wed, 15 December 2021 14:28
|
 |
|
Re: Focus problem
By: Silvan on Fri, 17 December 2021 23:01
|
 |
|
Re: Focus problem
By: Lance on Sat, 18 December 2021 05:39
|
 |
|
Re: Focus problem
By: Silvan on Sat, 18 December 2021 16:03
|
 |
|
Re: Focus problem
By: Silvan on Sat, 18 December 2021 16:22
|
 |
|
Re: Focus problem
By: Lance on Sat, 18 December 2021 17:17
|
 |
|
Re: Focus problem
By: Lance on Sat, 18 December 2021 17:24
|
 |
|
Re: Focus problem
By: Silvan on Sat, 18 December 2021 18:32
|
 |
|
Re: Focus problem
By: Silvan on Sun, 19 December 2021 12:23
|
 |
|
Re: Focus problem
By: Lance on Sun, 19 December 2021 14:22
|
 |
|
Re: Focus problem
By: Lance on Sun, 19 December 2021 14:31
|
 |
|
Re: Focus problem
By: Lance on Sun, 19 December 2021 14:44
|
 |
|
Re: Focus problem
By: Silvan on Sun, 19 December 2021 15:37
|
 |
|
Re: Focus problem
By: Silvan on Sun, 19 December 2021 15:59
|
 |
|
Re: Focus problem
By: Lance on Sun, 19 December 2021 16:16
|
 |
|
Re: Focus problem
By: Lance on Sun, 19 December 2021 16:24
|
 |
|
Re: Focus problem
By: Silvan on Sun, 19 December 2021 19:31
|
 |
|
Re: Focus problem
By: Lance on Mon, 20 December 2021 13:43
|
Goto Forum:
Current Time: Sun Aug 24 07:02:22 CEST 2025
Total time taken to generate the page: 0.05506 seconds
|