Hello,
On main() function i create form with widgets. how i can access widget from example function foo()?
I want append text change progress widget value and etc..
If i make form global then i get errors on runtime.

Hello, On main() function i create form with widgets. how i can access widget from example function foo()? I want append text change progress widget value and etc.. If i make form global then i get errors on runtime.

found solution!! smile always i found when start topic.. weird.

#include <......>
nana::progress* progresas1;

int i = 0;
void play(){
i++;
if (nullptr != progresas1)
progresas1->value(i);

}
void main(){
nana::form form;

nana::button btn(form, nana::rectangle{ 395, 165, 100, 30 });
btn.caption("Play");
btn.events().click([]{play(); });

nana::progress progresas{ form, nana::rectangle{ 5, 165, 275, 30 }, true };
progresas1 = &progresas;

}
found solution!! :D always i found when start topic.. weird. ```` #include <......> nana::progress* progresas1; int i = 0; void play(){ i++; if (nullptr != progresas1) progresas1->value(i); } void main(){ nana::form form; nana::button btn(form, nana::rectangle{ 395, 165, 100, 30 }); btn.caption("Play"); btn.events().click([]{play(); }); nana::progress progresas{ form, nana::rectangle{ 5, 165, 275, 30 }, true }; progresas1 = &progresas; } ````

Replace with


void main(){
nana::form form;
nana::progress progresas{ form, nana::rectangle{ 5, 165, 275, 30 }, true };
int i = 0;

nana::button btn(form, nana::rectangle{ 395, 165, 100, 30 });
btn.caption("Play");
btn.events().click([&]
{
    progresas->value(++i);
});

}
Replace with ```` void main(){ nana::form form; nana::progress progresas{ form, nana::rectangle{ 5, 165, 275, 30 }, true }; int i = 0; nana::button btn(form, nana::rectangle{ 395, 165, 100, 30 }); btn.caption("Play"); btn.events().click([&] { progresas->value(++i); }); } ````
edited Nov 1 at 9:03 pm

meh this very impractical for me.
And i will use it from other threads.

meh this very impractical for me. And i will use it from other threads.
19
views
3
replies
2
followers
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft