TTIWCheckListBox - line clicked on


Is there a way to figure out the line of a TTIWCheckListBox on which was clicked from within OnAsyncClick?

Best regards



Can you please try using the OnAsyncCheckClick event instead.
This event has an Index parameter that contains the index value of the CheckBox that was clicked.

Hi Bart,

well - that is working, but I would like to interact with the user in a seperate way when he clicks the text of a line and not the checkbox.

Is that somehow possible?

Best regards


BTW Thanks for your fast answer.

Hi Bart,

I figured out that I can use <a> tags in the items.
So - I think - it should be no problem to anchor-tag the item text and call via the anchor tag an AJAX endpoint in my Intraweb application.
So That way I could do it,
Post the code here ... when I got that done.

Ok. This is how I got it working:

1. Wrap the TTIWCheckListBox items with a span that changes the cursor to a pointer and that calls a javascript function of the intraweb form on which the TTIWCheckListBox  resides that will trigger a calback to the Intraweb server ...
This example procedure would build something like that ...

procedure TExampleIntrawebForm.UpdateCheckListBox;
  sl: TStringList;
  I: Integer;
  sl := CheckListBoxItems.Items;
  for I := 0 to sl.Count - 1 do
    sl.Strings := '<span style=''cursor: pointer'' onclick=calliw(''' + sl.Strings + ''')>' +
      sl.Strings + '</span>';

This code results in items that call the javascript function calliw with the text of the item as parameter ...

2. Implement the Javascript function to do the callback to the Intraweb backend in the Javascript property of the form containing the checklistbox ...

function calliw(event){   executeAjaxEvent("&itemtext="+event, null,"OnItemClick",false, null, false); };

This code calls the OnItemClick in the Intraweb Backend. The thing not very easy to figure out is the way how you need to pass the additional parameters via "&itemtext="+event

3. In the Intraweb form implement the callback function

procedure TExampleIntrawebForm.OnItemClick(EventParams: TStringList);

4. Further you need to register the callback OnItemClick with the Intraweb backend

procedure TExampleIntrawebForm.IWAppFormCreate(Sender: TObject);
  WebApplication.RegisterCallBack('OnItemClick', OnItemClick);

Then we have clickable itemtext to and a clickhandler in the backend.

@Bart: Couldn't something like this be implemented in the standard components?

Best regards


Thank you for your suggestion.

We'll have to investigate if this can be added in a future version of the TTIWCheckListBox control.