16 lines
No EOL
544 B
C++
16 lines
No EOL
544 B
C++
import Crafter.CppDOM;
|
|
import std;
|
|
using namespace Crafter;
|
|
|
|
HtmlElementPtr body("body","<h1>Interactive Element Demo</h1>"
|
|
"<button id='myButton'>Click Me!</button>"
|
|
"<p id='output'>Click the button above</p>");
|
|
HtmlElementPtr button("myButton");
|
|
HtmlElementPtr output("output");
|
|
|
|
|
|
int main() {
|
|
button.AddClickListener([](Crafter::MouseEvent event){
|
|
output.SetInnerHTML("Button was clicked at (" + std::to_string(event.clientX) + ", " + std::to_string(event.clientY) + ")!");
|
|
});
|
|
} |