Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Is there a message when a control contents changes?
Is there a message when a control contents changes? [message #43844] Tue, 04 November 2014 02:13 Go to next message
rxantos is currently offline  rxantos
Messages: 72
Registered: October 2011
Member
I want to enable/disable an Apply button inside a dialog if the contents of the controls inside it changes.

Assuming a dialog with many EditString controls. What would be the most efficient (if possible without polling) way to know if any of the controls inside the dialog changed?
Re: Is there a message when a control contents changes? [message #43846 is a reply to message #43844] Tue, 04 November 2014 19:53 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 680
Registered: November 2008
Location: France
Contributor
Hello Rxantos,

basically all the GUI management is based on events, so if you wan't to do some action if a ctrl changes, use the callbacks of the controls for that (usually the names of the callback members are like : "when...." : WhenAction, WhenPush, ....
You will have to set the callback of all the ctrls you wan't to monitor inside you're dialog.

A nice feature about callbacks is that you can put several actions (callbacks) in one callback !!
You have to use the << operator for this like in this example :
(button.WhenAction << THISBACK(actionOne)) << THISBACK(actionTwo);

This allows you to monitor callbacks while still allowing normal use of the callbacks
Re: Is there a message when a control contents changes? [message #43848 is a reply to message #43846] Wed, 05 November 2014 08:17 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

Hello Didier

That is a nice tip to remember.

Thank you
Jerson
Re: Is there a message when a control contents changes? [message #43849 is a reply to message #43848] Wed, 05 November 2014 14:09 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Important note:

WhenAction is triggered when USER changes the widget (I mean, if the change is a result of user-initiated input event). Changing value by client code does not trigger WhenAction.

(Of course, it also depends on how widget is actually implemented, but all widgets should follow this rule).

Mirek
Previous Topic: Character array
Next Topic: ArrayPair, where is it ?
Goto Forum:
  


Current Time: Wed Apr 17 00:38:22 CEST 2024

Total time taken to generate the page: 0.01625 seconds