in your application case you want to create buttons dynamically. The buttons have then to be connected to concrete (not dynamic surely) operations. The approach with comparing sender will not work in this case, because the buttons are created dynamically and their addresses are not known unless you save the addresses of the buttons in variables and use the variables then.
What I would do? Besides many other options I would propose the following both:
Option 1: Even when you create the buttons dynamically, the operations the buttons are associated to are predetermined. You could thus implement for each operation a separate slot method and when creating a button dynamically associate the button with the desired slot method directly. Evaluating sender is not needed anymore.
Option 2: Obviously you have implemented the push button in your own component Application::PushButtonGraficoTemplates. You can enhance this component by some additional property named e.g. Tag or Id, etc. When you create a push button dynamically, you initialize the new property with a value corresponding to the operation of the button. Within the slot method associated to all buttons you can then evaluate the value stored in the buttons activated by user as shown below:
var Application::PushButtonGraficoTemplates button = (Application::PushButtonGraficoTemplates)sender:
if ( button != null )
switch ( button.Tag )
case 1 : /* button with Tag == 1 pressed */;
case 2 : /* button with Tag == 2 pressed */;
Does it help you further?
Ask Embedded Wizard
Welcome to the question and answer site for Embedded Wizard users and UI developers.
Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!