mirror of
https://github.com/s00500/ESPUI.git
synced 2024-11-24 07:20:53 +00:00
Corrected class example
This commit is contained in:
parent
36f6932538
commit
a553d32570
@ -154,6 +154,8 @@ Alternativly you may use the extended callback funtion which provides three para
|
|||||||
<br><br>
|
<br><br>
|
||||||
The below example creates a button and defines a lambda function to implicitly create an `ExtendedCallback` which then invokes a more specialized button callback handler. The example uses the `UserParameter` to hold the `this` pointer to an object instance, providing a mechanism for sending the event to a specific object without the need for a switch / map / lookup translation of the Sender Id to an object reference.
|
The below example creates a button and defines a lambda function to implicitly create an `ExtendedCallback` which then invokes a more specialized button callback handler. The example uses the `UserParameter` to hold the `this` pointer to an object instance, providing a mechanism for sending the event to a specific object without the need for a switch / map / lookup translation of the Sender Id to an object reference.
|
||||||
```
|
```
|
||||||
|
void YourClassName::setup()
|
||||||
|
{
|
||||||
ButtonElementId = ESPUI.addControl(
|
ButtonElementId = ESPUI.addControl(
|
||||||
ControlType::Button,
|
ControlType::Button,
|
||||||
ButtonLabel.c_str(),
|
ButtonLabel.c_str(),
|
||||||
@ -168,6 +170,7 @@ ButtonElementId = ESPUI.addControl(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
this); // <-Third parameter for the extended callback
|
this); // <-Third parameter for the extended callback
|
||||||
|
}
|
||||||
```
|
```
|
||||||
```
|
```
|
||||||
void YourClassName::myButtonCallback(Control* sender, int eventname)
|
void YourClassName::myButtonCallback(Control* sender, int eventname)
|
||||||
|
Loading…
Reference in New Issue
Block a user