lifecycle update
This commit is contained in:
parent
84ce42f106
commit
0b7a43efbd
14 changed files with 950 additions and 490 deletions
|
|
@ -2,16 +2,15 @@ import Crafter.CppDOM;
|
|||
import std;
|
||||
using namespace Crafter;
|
||||
|
||||
|
||||
HtmlElement* body = new HtmlElement("body", R"(<h1>Input GetValue() and SetValue() Example</h1><br><input id="input" type="text" placeholder="Enter your text here..."><br><button id="button">Change Value</button><p id ="valueOutput"></p>)");
|
||||
HtmlElement* button = new HtmlElement("button");
|
||||
HtmlElement* output = new HtmlElement("valueOutput");
|
||||
HtmlElement* input = new HtmlElement("input");
|
||||
HtmlElementPtr body("body", R"(<h1>Input GetValue() and SetValue() Example</h1><br><input id="input" type="text" placeholder="Enter your text here..."><br><button id="button">Change Value</button><p id ="valueOutput"></p>)");
|
||||
HtmlElementPtr button("button");
|
||||
HtmlElementPtr output("valueOutput");
|
||||
HtmlElementPtr input("input");
|
||||
|
||||
int main(){
|
||||
button->AddClickListener([](Crafter::MouseEvent) {
|
||||
std::string newValue = input->GetValue();
|
||||
output->SetInnerHTML(newValue);
|
||||
input->SetValue("");
|
||||
button.AddClickListener([](Crafter::MouseEvent) {
|
||||
std::string newValue = input.GetValue();
|
||||
output.SetInnerHTML(newValue);
|
||||
input.SetValue("");
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue