Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Enable or Visible Event ?
Message
From
08/11/1997 11:00:57
 
 
To
08/11/1997 09:35:21
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00058138
Message ID:
00059080
Views:
36
>>>Programmatic change watches the value in a control. It is fired when the
>>value is changed from code, and interactive change is fired when the user
>>changes the value. It cannot be used to watch the values of other
>>properties
>>
>>Alright, thanks for the info. If that is true though and if I'm
>>reading the question correctly and he is programatically changing
>>the Enabled or Visible status, all he would have to do in
>>addition to changing these properties would be to change a value
>>in a control. This would in turn trigger the programatic change.
>>I know . . . a lot of extra work when this can be handled much
>>better with a timed event. Just curious if this could work.
>
>Why not make an invisible control with its
>controlsource=othercontrol.enabled, then watch its ProgrammaticChange
>event? It just might work.
>
>I've tried it, and it almost does ;(.
>
>I've made a form with two command buttons and a checkbox;
>command2.click just flips the command1.enabled, and the
>check1.controlsource="thisform.command1.enabled". The
>check1.programmaticchange never fired. Tried interactive,
>it doesn't fire either. I wanted it to fire whenever I clicked
>command2, but I also wanted its caption to be changed from
>"Enabled" to "Disabled", so I put
>
> this.caption=Iif(this.value, "Enabled","Disabled")
>
>into check1.refresh and called thisform.refresh at the end of
>command2.click - didn't work either. What's worse,
>check1.refresh fires before the check1.value changes,
>(though the command1.enabled has already changed, and
>the button was greyed or blacked already) so I got the
>wrong caption all the time.
>
>I still believe that using timers to catch events which we
>can't catch otherwise is just a workaround and includes
>some risks (overhead, firing when some other, more
>important event is active), so they need lot of care in
>order to work fine.
>
>Probably the best approach in this case is to add specialized
>methods to the form which would swap the state of the desired
>objects, and perform any other action necessary. So, instead of
>Thisform.command1.enabled=.f., we'd better call
>Thisform.command1driver("enable") to do that and all the other
>stuff, and use only that to enable/disable command1.


Maybe I wasn't reading your post correctly, but I did not see
any place that you actually change the "this.value". As Erik said
you have to change the "this.value" not the "this.controlsource" to
trigger the programmatic change event. Anyways the point is moot.
I think Erik's method using timers is going to be a better way of
handling the problem, for reasons he suggested earlier in the
thread. Try that first.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform