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 » U++ Library support » U++ Callbacks and Timers » THISBACK and inheritance
Re: THISBACK and inheritance [message #48483 is a reply to message #48482] Thu, 06 July 2017 23:17 Go to previous messageGo to previous message
Oblivion is currently offline  Oblivion
Messages: 1093
Registered: August 2007
Senior Contributor
Hello Daniel,

Quote:

But why is it working for the OnClickButton callbacks in the FnWindow?


It is because those button events aren't called immediately. They are called when there is some user action (They are called WHEN there is action (click/push, etc.).
Had they been called immediately you would have the same undefined behaviour.
On the other hand, MenuBar::Set() method calls the provided callback, and sets the menubar immediately, which leads to crash.

Quote:


What macros do you mean and how can I avoid them?


Ah, that's my fault. Nevermind. (For some reason, the below macros reminded me of U++ internal macros used in the TheIDE layout editor.)

#define _FN_LABEL(button, label)    button.SetLabel(label).Enable(true)
#define FN_LABEL(number, label)     _FN_LABEL(b_fn##number, label)

#define _FN_UNLABEL(button) button.SetLabel("").Enable(false)
#define FN_UNLABEL(number)  _FN_UNLABEL(b_fn##number)



Best regards,
Oblivion.



[Updated on: Fri, 07 July 2017 06:26]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: About storing references and pointers to callbacks.
Next Topic: [REQUEST]: Allow callback() template to work also with non-void and non-bool return types.
Goto Forum:
  


Current Time: Sun Apr 28 14:53:35 CEST 2024

Total time taken to generate the page: 0.06372 seconds