Page 21 of 25

Posted: Wed Jan 17, 2007 10:02 pm
by srod
In the #egrid_NotifyCellType message, assuming you've declared the checkbox type cell with something like:

Code: Select all

*cellinfo\celltype=#egrid_CheckBox
*cellinfo\text="TRUE/FALSE"
(you can use any values in place of TRUE/FALSE; e.g. "YES/NO" etc.)

then the following command:

Code: Select all

egrid_SetCellText(#egrid, col, row, "TRUE")
will check the (col, row) cell's checkbox etc.

Is this what you're after?

Posted: Wed Jan 17, 2007 10:10 pm
by ts-soft
No :)
If the user change the state of checkbox, without selecting, only click on
checkbox, i will have this event in cellcallback.

like #egrid_CellButtonClick, but for checkbox.

Code: Select all

#egrid_CellUpdated
#egrid_InsertChar
#egrid_SelectCell
doesn't do this for me

Posted: Wed Jan 17, 2007 10:14 pm
by srod
Right, if I now understand correctly, you wish to be notified when the user clicks to change the checkmark (from true to false for example) but does not select the cell?

Am I correct? :)

Posted: Wed Jan 17, 2007 10:15 pm
by ts-soft
srod wrote: Am I correct? :)
Your are correct, ever :wink:
but my english is badly :lol:

Posted: Wed Jan 17, 2007 10:17 pm
by srod
You can certainly do this with the #egrid_CellUpdated message. It fires whenever the user alters a checkmark when the cell is not selected.

If the cell is already selected then the message will fire when focus moves to another cell.

Posted: Wed Jan 17, 2007 10:20 pm
by srod
merihevonen wrote:This is really a wonderful project btw.
Thanks. :)

Posted: Wed Jan 17, 2007 10:27 pm
by ts-soft
srod wrote:You can certainly do this with the #egrid_CellUpdated message. It fires whenever the user alters a checkmark when the cell is not selected.

If the cell is already selected then the message will fire when focus moves to another cell.

Code: Select all

    Case #egrid_CellUpdated
      result = #True
      If CountSelected() <> Count
        Count = CountSelected()
        SetWindowTitle(0, "Lib2PBImport - " + LibName + "     [" + Str(CountSelected()) + " of " + Str(egrid_NumberOfRows(#egrid)) + " Functions selected]")
      EndIf
doesn't work :cry:

Posted: Wed Jan 17, 2007 10:32 pm
by srod
All I can say is that I'm sitting here with a quickly bashed up example which works fine!

I can't comment upon the contents of your #egrid_CellUpdated handler, but you can at least test out if the message is firing by placing a messagerequester immediately after the case #egrid_CellUpdated command etc.

I'll pm you.

Posted: Wed Jan 17, 2007 10:33 pm
by ts-soft
here the CountSelected()

Code: Select all

Procedure CountSelected()
  Protected i.l, count.l
  For i = 0 To egrid_NumberOfRows(#egrid) -1
    If egrid_GetCellText(#egrid, 0, i) = "TRUE"
      count + 1
    EndIf
  Next
  ProcedureReturn count
EndProcedure
count is a static variable

Posted: Wed Jan 17, 2007 10:35 pm
by netmaestro
I catch that event in a couple of my apps, I cut the snippet from one:

Code: Select all

  If message = #WM_NOTIFY 
    *ptr.NMHDR = lParam 
    If *ptr\HwndFrom = GadgetID(#List_1) 
      Select *ptr\code 
        Case #LVN_ITEMCHANGED 
          MyChangeEvent(#True) 
fires on a checkmark change, dunno if it helps you or not.

Posted: Wed Jan 17, 2007 10:43 pm
by srod
@ts-soft: here's the problem. When the #egrid_CellUpdated message fires, the cell that has just been clicked has NOT had it's contents physically changed. This gives the developer the chance to refuse the alteration etc.

So, what you'll need to do is, for the cell which has just been clicked, rather than use egrid_GetCellText() (which will contain the old value) simply examine the value of *cellinfo\text instead; this contains the new contents if you allow the alteration to proceed.


The sequence is as follows: (imagine cell (0, 0) is a checkbox which currently holds the value "FALSE")
  • User clicks the checkmark in cell (0, 0)
  • The #egrid_CellUpdated message fires. Cell (0, 0) still contains the value "FALSE", but *cellinfo\text contains "TRUE"
  • You call your CountSelected() procedure.
  • Return control to egrid which only now changes cell (0, 0) to "TRUE" (unless you've refused the change).
Hope this helps.

:)

Posted: Wed Jan 17, 2007 10:46 pm
by srod
netmaestro wrote:I catch that event in a couple of my apps, I cut the snippet from one:

Code: Select all

  If message = #WM_NOTIFY 
    *ptr.NMHDR = lParam 
    If *ptr\HwndFrom = GadgetID(#List_1) 
      Select *ptr\code 
        Case #LVN_ITEMCHANGED 
          MyChangeEvent(#True) 
fires on a checkmark change, dunno if it helps you or not.
This message will not work as it is with an egrid because the underlying cell of the listicon is not always kept up to date with what is going on in the edit controls / comboboxes etc. (in fact there are no actual checkbox controls as egrid simulates these).
This was done to combat flickering etc.

This is all dealt with by egrid.

Posted: Wed Jan 17, 2007 10:54 pm
by ts-soft
thanks, it works :D

Posted: Wed Jan 17, 2007 10:57 pm
by srod
That's great. We got there in the end! :)

Posted: Wed Jan 17, 2007 11:30 pm
by ts-soft
srod wrote:That's great. We got there in the end! :)
The next problem, if the checkbox is selected, i become no changes :cry:
I'm tested all, but nothing fires this event.
I hope, you can give me a tip :)