Discussion:
Checkbox in Listbox
John Kouraklis
2012-02-27 00:26:28 UTC
Permalink
Hi to all,

I have a checkbox in a listbox. What I want to do is to execute a code when
the user changes the checkbox state.

I use the cell action event but if doesn't fire properly. Also, the cell
click fires before the state is changed although it appears at the UI that
the checkbox has changed.

What is the correct event to use

Thanks

john


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
Ask Greiffenberg
2012-02-27 10:49:50 UTC
Permalink
I think that it is the correct event.
Just take in to consideration that the state is inverted (by using "not" for example)

Can you elaborate on "cell action event not firing properly"? I can't recall having problems with that.
Post by John Kouraklis
Hi to all,
I have a checkbox in a listbox. What I want to do is to execute a code when
the user changes the checkbox state.
I use the cell action event but if doesn't fire properly. Also, the cell
click fires before the state is changed although it appears at the UI that
the checkbox has changed.
What is the correct event to use
Thanks
john
_______________________________________________
<http://www.realsoftware.com/support/listmanager/>
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
Harrie Westphal
2012-02-27 19:25:30 UTC
Permalink
Post by John Kouraklis
I have a checkbox in a listbox. What I want to do is to execute a code when
the user changes the checkbox state.
I use the cell action event but if doesn't fire properly. Also, the cell
click fires before the state is changed although it appears at the UI that
the checkbox has changed.
CellClick is where you would typically put the code to alter the appearance of the checkbox. If the first column holds the checkbox something like the following would change it from checked to unchecked in the CellClick event. If you intend to do more I guess you would have to change it and then check if it is now True and call any other methods that may be needed.

if column=0 then
me.cellCheck(row,column)=not me.cellCheck(row,column)
end if

To date any listboxes I have used with checkboxes were only for setting the states of the checkboxes and a later button or menu option would then do additional steps based on the checkbox settings at that time.



=== A Mac addict in Tennessee ===

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
Eduardo Gutierrez de Oliveira
2012-08-22 21:57:45 UTC
Permalink
Revisiting this, for the archives...

It's common to change checkboxes in listboxes with the keyboard ("space" is usually used).

In those cases "keydown" may be needed as well.

For clicking the checkbox cellclick and cellaction as triggered.

To me, checking and unchecking should trigger a cellaction regardless of how it's done, but perhaps I'm seeing it differently than the programmers.

It does seem silly to me that no single event tracks checkboxes in listboxes though.

Since more than one event might track the checkbox it makes sense to put the logic in a separate function that can be called. That way a keyboard shortcut for checking and unchecking could also trigger it (since the listbox wouldn't trigger any event).
Post by Harrie Westphal
Post by John Kouraklis
I have a checkbox in a listbox. What I want to do is to execute a code when
the user changes the checkbox state.
I use the cell action event but if doesn't fire properly. Also, the cell
click fires before the state is changed although it appears at the UI that
the checkbox has changed.
CellClick is where you would typically put the code to alter the appearance of the checkbox. If the first column holds the checkbox something like the following would change it from checked to unchecked in the CellClick event. If you intend to do more I guess you would have to change it and then check if it is now True and call any other methods that may be needed.
if column=0 then
me.cellCheck(row,column)=not me.cellCheck(row,column)
end if
To date any listboxes I have used with checkboxes were only for setting the states of the checkboxes and a later button or menu option would then do additional steps based on the checkbox settings at that time.
=== A Mac addict in Tennessee ===
_______________________________________________
<http://www.realsoftware.com/support/listmanager/>
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
John Kouraklis
2012-08-22 22:34:10 UTC
Permalink
Eduardo,

I didn't know that two events are triggered by the checkbox.

Thanks for the info

Regards
John
Post by Eduardo Gutierrez de Oliveira
Revisiting this, for the archives...
It's common to change checkboxes in listboxes with the keyboard ("space" is usually used).
In those cases "keydown" may be needed as well.
For clicking the checkbox cellclick and cellaction as triggered.
To me, checking and unchecking should trigger a cellaction regardless of
how it's done, but perhaps I'm seeing it differently than the
programmers.
It does seem silly to me that no single event tracks checkboxes in listboxes though.
Since more than one event might track the checkbox it makes sense to put
the logic in a separate function that can be called. That way a keyboard
shortcut for checking and unchecking could also trigger it (since the
listbox wouldn't trigger any event).
Post by Harrie Westphal
Post by John Kouraklis
I have a checkbox in a listbox. What I want to do is to execute a code when
the user changes the checkbox state.
I use the cell action event but if doesn't fire properly. Also, the cell
click fires before the state is changed although it appears at the UI that
the checkbox has changed.
CellClick is where you would typically put the code to alter the
appearance of the checkbox. If the first column holds the checkbox
something like the following would change it from checked to unchecked
in the CellClick event. If you intend to do more I guess you would have
to change it and then check if it is now True and call any other methods
that may be needed.
if column=0 then
me.cellCheck(row,column)=not me.cellCheck(row,column)
end if
To date any listboxes I have used with checkboxes were only for setting
the states of the checkboxes and a later button or menu option would
then do additional steps based on the checkbox settings at that time.
=== A Mac addict in Tennessee ===
_______________________________________________
<http://www.realsoftware.com/support/listmanager/>
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
<http://www.realsoftware.com/support/listmanager/>
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

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

Continue reading on narkive:
Loading...