added view
This commit is contained in:
parent
5517a271c7
commit
580e53d3bc
11 changed files with 68 additions and 34 deletions
|
|
@ -2,15 +2,15 @@ import Crafter.CppDOM;
|
|||
import std;
|
||||
using namespace Crafter;
|
||||
|
||||
HtmlElement body("body","<h1>Interactive Element Demo</h1>"
|
||||
HtmlElementView body("body","<h1>Interactive Element Demo</h1>"
|
||||
"<button id='myButton'>Click Me!</button>"
|
||||
"<p id='output'>Click the button above</p>");
|
||||
HtmlElement* button = new HtmlElement("myButton"); //prevent destruction
|
||||
HtmlElementView* button = new HtmlElement("myButton"); //prevent destruction
|
||||
|
||||
|
||||
int main() {
|
||||
button->AddClickListener([](Crafter::MouseEvent event){
|
||||
auto output = HtmlElement("output");
|
||||
auto output = HtmlElementView("output");
|
||||
output.SetInnerHTML("Button was clicked at (" + std::to_string(event.clientX) + ", " + std::to_string(event.clientY) + ")!");
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue