I do this too...and, like you, I do it a lot.  That was my point: does
your program need to be told that it just modified the state/contents
of a control?

For editFields, I suggested a while back a new event 'UserTextChanged'
that would fire if the user, not the program, changed the text,
eliminating the need for these gymnastics that I'm sure all of us have
to do.  This could be generalized to many/all controls.

P.

On 3/8/07, Peter E. Barck <[EMAIL PROTECTED]> wrote:
> Peter K. Stys, MD wrote:
>
> >I have an array of checkboxes, I want the clicked one to look checked
> >(like a radio button group, but I want checkboxes):
> >
> >Sub Action(index as Integer)
> >   dim j as integer
> >
> >   ' clear all but the index checkbox
> >   for j = 0 to 3
> >     if (j = index) then
> >       self.CheckBox1(j).value = true
> >     else
> >       self.CheckBox1(j).value = false
> >     end if
> >   next
> >
> >   Return
> >End Sub
> >
> >You'd think this would be a no-brainer but it doesn't work because the
> >self.CheckBox1(j).value = true/false stmnts fire new Action events in
> >the other (jth) checkboxes so everything gets screwed up.
> >
> >I think firing events in response to control changes in done in code
> >is a dumb idea.  Action is a user action, not a program's execution.
> >If I'm explicitly doing self.CheckBox1(j).value = true I don't need to
> >be told that I've just done this by having a new event fired!
> >
> >Ditto for TextChanged events in editfields, etc...
> >
> >There should be an easy way to tell whether an "event" was triggered
> >by the user vs. code.
> >
> >Don't others agree?
> >
> >P.
>
> Well, what I do in these situations, and I do it a lot:
>
> Define a boolean property for the window containing the control (
> meActive default = False)
>
> In the Controls MouseDown event;  meActive = True
>
> in the Controls Action event:
>     If meActive Then
>        meActive = False
>       //  do your thing .....
>     end if
>
> This way only if you clicked on the control your action code will be
> executed.  It's not foolproof but works quite well.  If you want to
> be foolproof, in the  Lost Focus event set meActive = False just in
> case the Action event was not triggered.
>
> HTH
> --
>     Cheers,
>     Peter
>
>      TI PowerBook G4, 1GHz, 1GB RAM, OSX 10.3.9, RB2007r1 Pro
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
>
> Search the archives:
> <http://support.realsoftware.com/listarchives/lists.html>
>


-- 
-------------------------------------------------------------------------------
Peter K. Stys, MD
Professor of Medicine(Neurology), Senior Scientist
Ottawa Health Research Institute, Div. of Neuroscience
Ottawa Hospital / University of Ottawa
Ontario, CANADA
tel:    (613)761-5444
fax:    (613)761-5330
http://www.ohri.ca/profiles/stys.asp
-------------------------------------------------------------------------------
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to