Re: [Gambas-user] How to stop a control raising events?

2017-08-13 Thread Tony Morehen
Careful, though, Object.Lock inhibits all events associated with a 
control, including events from internal controls.  For example, DirView 
has an internal TreeView control.  When you click on a folder or set the 
Current property in code,  DirView tells the TreeView to expand that 
branch.  TreeView then raises the Expand event, requesting that DirView 
fill in the sub-folders of that branch.  After that is done, DirView 
raises its click event.


I wanted the click event to only occur when the user clicks on a folder 
so I surrounded the code setting DirView.Current with 
object.lock/unlock.  All of a sudden, DirView stopped updating 
properly.  This seemed to occur only during the initialization of 
DirView.  It took me 2 days to figure out that the object.lock stopped 
the TreeView Expand event so DirView did not update. Another control was 
setting the DirView Current property during its initialization, not any 
of my own code, which made debugging even harder.


I wound up replacing the object.lock with a boolean flag.  When set, the 
flag stops the Click event code from running.



On 2017-08-13 06:18 PM, Tobias Boege wrote:

On Mon, 14 Aug 2017, adamn...@gmail.com wrote:

(A quicky!)

Wasn't there a way to temporarily stop a control raising events, MyControl.Lock 
or somesuch? My memory fails!
tia
bruce

Object.Lock(x)





--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] How to stop a control raising events?

2017-08-13 Thread adamn...@gmail.com
Thanks Tobi!
b

On Mon, 14 Aug 2017 00:18:46 +0200
Tobias Boege  wrote:

> On Mon, 14 Aug 2017, adamn...@gmail.com wrote:
> > (A quicky!)
> > 
> > Wasn't there a way to temporarily stop a control raising events, 
> > MyControl.Lock or somesuch? My memory fails!
> > tia
> > bruce
> 
> Object.Lock(x)
> 
> -- 
> "There's an old saying: Don't change anything... ever!" -- Mr. Monk
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user


-- 
B Bruen 

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] How to stop a control raising events?

2017-08-13 Thread Tobias Boege
On Mon, 14 Aug 2017, adamn...@gmail.com wrote:
> (A quicky!)
> 
> Wasn't there a way to temporarily stop a control raising events, 
> MyControl.Lock or somesuch? My memory fails!
> tia
> bruce

Object.Lock(x)

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] How to stop a control raising events?

2017-08-13 Thread adamn...@gmail.com
(A quicky!)

Wasn't there a way to temporarily stop a control raising events, MyControl.Lock 
or somesuch? My memory fails!
tia
bruce

-- 
B Bruen 

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user