07-04-2012 02:03 PM
I have a cutsom control that I want to hide.
myCustomControl.visible = false;
... but the control doesn't get hidden.
Is this because I need to individually hide each of the sub-controls that make up my custom control? I am surprised that this doesn't "just work".
07-04-2012 02:07 PM
Maybe that's not the problem...
07-04-2012 02:21 PM
The issue was that I also needed to connect up the signal to my handler:
Note that the example:
... somewhat bizarrely sets up this connection in an onClick handler:
cppObject.value = cppObject.value + 1;
07-05-2012 02:56 PM
Sounds like you addressed everything except for being puzzled over where a connect was done in a sample app.
In general, I would expect the connects to be done where you suggest, in onCreationComplete.
Some apps may have good reasons to do it elsewhere:
- if the object handling the message is dynamically created only as needed. The connect has to wait until then
- some behaviour is turned on or off, and connect is used to manage this
- the code needs to be developed quickly and the other spot is easier
- the code is for demonstration purposes and the connect is incidental; adding the best handler may add noise to what is being demonstrated.
One could quibble with my last point, perhaps.
I agree that onCreationComplete would be my default choice. (Actually, I tend to use C++ more and tend to have my connects and handlers in C++)
Were you just musing, or do you think the sample app is misleading and should be adjusted? If the sample is in git-hub you should be able to make some corrections to a clone and issue a pull request.
08-15-2012 11:54 AM
Sorry for the delayed response.
I do think it would be worth adjusting the sample code if that seems reasonable.