Jump to content

New TUniCheckListBox component


Recommended Posts

If you add items at design time it working.

 

But at runtime you get error: 

UniCheckListBox1.Items.Add('Test 1');
Failed to execute 'querySelectorAll' on 'Element': 'input[type=checkbox]:nth(1)' is not a valid selector.

O40.insert(0,{id:"0",val:"Test 1"});O3C.boundList.refresh();O3C.el.select("input[type=checkbox]:nth(1)").elements[0].disabled=0;_sfv_(O3C,0,"");

 

Project attached.

 

 

http://www.rgreat.ru/tmp/Delphi/sgtest.exe- compiled file.

sgtest.zip

Link to comment
Share on other sites

rgreat, I've added the "margin-left: 0px; margin-top: 0px;", in fact it looks nicer.

If I understand correctly, you are trying to use the component with the Beta version, running on Ext JS 6.5.

Unfortunately, at the moment I've not installed that version, so I cannot help you.

Maybe someone else on the forum can help you to fix the issues....

Link to comment
Share on other sites

Fix for ExtJS 6.5.3:

 

Unichecklst.pas

procedure TUniCheckListBox.SynchronizeJSCheck(Index: integer);
var i: integer;
begin
  for i:=IfThen(Index=-1, 0, Index) to IfThen(Index=-1, Count-1, Index) do // nth(n) (1 based)
    JSInterface.JSCode(#1'.el.select("input[type=checkbox]").elements['+i.ToString+'].checked='+Selected[i].ToString.ToLower+';');
end;

procedure TUniCheckListBox.SetReadOnly(Value: Boolean);
var i: integer;
begin
  // Problem if Items set to design-time and ReadOnly set to TRUE, because it has not yet digested the WebCreate
  if Value<>FReadOnly then
    begin
      FReadOnly:=Value;
      if not (csDesigning in ComponentState) then
        for i:=0 to Count-1 do // nth(n) (1 based)
          JSInterface.JSCode(#1'.el.select("input[type=checkbox]").elements['+i.ToString+'].disabled='+FReadOnly.ToString.ToLower+';');
    end;
end;

I think it will work in old versions too.

Link to comment
Share on other sites

  • 2 weeks later...

ola, estou usando seu componente, mas me deparei com um problema ao definir as propriedades selecionadas com a meta visível: = false, ele gera um erro. [/ size]

 

put a component, set visible :=false;

 

 

 

    for I := 0 to (cList.Items.Count - 1) do

    begin
                cList.Selected:=True;
    end;
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...