On Thu, Jan 10, 2013 at 9:59 AM, Staffan Tylen <staffan.ty...@gmail.com>wrote:
> Mark, I understand quite well that you don't understand because I didn't
> express myself well at all. I'll have another go:
>
> I've got a listview defined with the CHECKBOXES style. I've chosen to
> insert a first row -ALL- that when checked should cause all rows to be
> checked, and if unchecked all rows should be unchecked. I've implemented
> the onCheckBoxChanged event and there I test if the first row is
> checked/unchecked, in which case I call the (un)checkAll method (within the
> event handler) to set the check marks accordingly. But I can't get this to
> work and I assume it's because the event handler gets invoked from itself
> this way and as it runs unguarded the results are unpredictable more or
> less. So my question is: because (un)check(All) are invoked under program
> control, i.e. the user is not causing the events, it seems natural if the
> event handler is NOT invoked under those circumstances, the programmer
> already has full control of what's going on anyway, hopefully ;)
>
> So my suggestion is that these methods don't trigger these events, as they
> really are no 'events' as such.
>
Staffen,
The ooDialog methods checkAll or uncheckAll do not, in themselves, trigger
the event. The have no control over it.
The underlying list-view control sends an event notification every time an
item that has check boxes is checked or unchecked. It sends this event
always. In fact, all event notifications that you can "connect" in
ooDialog are *always* sent.
The act of "connecting" the event in ooDialog causes the framework to
intercept the "connected" event and invoke a method in the Rexx dialog.
This is an all or nothing process. If you connect the event, every time
it happens, your Rexx method is invoked.
There is currently no way to remove a connected event once you connect it.
You will need to do something in your code if this is a problem for you. I
would think an user interface change would make the most sense. I.e.
remove the ALL list item and add a push button for check or uncheck all. I
myself would favor adding a context menu to the list view. One item in the
menu is Check All, another item in the menu is Uncheck All. Or if you have
a menu bar, add the menu items there.
Another possibility might be to reply early in the event handler, then use
either the start method to start an asynchronous method in your dialog that
does the check or uncheck all. Set a flag in it so that when the event
handler gets the second event for the All item, it doesn't redo the check
all or uncheck all. Something along this line could be made to work, but
it will be convoluted and I would shy away from it unless you are dead set
on your current user interface.
--
Mark Miesfeld
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users