• TRzCheckTree的使用


    TRzCheckTree的使用 收藏
    1. 判断状态:

    if RzCheckTree1.Selected.StateIndex = 2 then
    //则为选中状态
    else if RzCheckTree1.Selected.StateIndex = 1 then
    //则为未选中状态
    else if RzCheckTree1.Selected.StateIndex = 3 then
    //则为未全选状态

    或者

    if RzCheckTree1.ItemState[I] = csUnchecked then //为未选中状态
    if RzCheckTree1.ItemState[I] = cschecked then //为选中状态


    2: 设置

    RzCheckTree1.ItemState[I] := csUnchecked //为未选中状态
    RzCheckTree1.ItemState[I] := cschecked //为选中状态

    权限树的创建

    procedure CreatePermissionsTree(DataSet: TADOQuery; Tree: TRzCheckTree;
    const TableName, aid, aname, quanXian: string);
    const
    ID_DEPT = 2;
    var
    nLevel: Integer;
    pNodes: array[0..1023] of TTreeNode;
    lpid, lpName, s: string;
    begin
    if DataSet = nil then Exit;
    if Tree = nil then Exit;
    if TableName = '' then Exit;
    pNodes[0] := nil;
    Tree.Items.Clear;
    with DataSet do
    begin
    Close;
    SQL.Clear;
    s := Format('select * from %s order by %s', [TableName, aid]);
    SQL.Text := s;
    Open;
    if IsEmpty then Exit;
    First;
    while not Eof do
    begin
    lpid := FindField(aid).AsString;
    lpName := FindField(aname).AsString;
    nLevel := Length(lpID) div ID_DEPT;

    pNodes[nLevel] := Tree.Items.AddChild(pNodes[nLevel - 1], lpName);
    if FindField('quanxian').AsBoolean then
    pNodes[nLevel].StateIndex := 2
    else pNodes[nLevel].StateIndex := 1;
    Next;
    end;
    end;
    end;

  • 相关阅读:
    python中进程池和回调函数
    python网络编程中互斥锁与进程之间的通信
    python支持的进程与线程
    python网络编程之进程
    python网络编程之粘包
    python中socket编程
    python的异常处理
    webstorm(四):webstrom配置一键修复ESLint的报错
    JavaScript Array map() 方法
    ES6之Array.includes()函数
  • 原文地址:https://www.cnblogs.com/martian6125/p/9631118.html
Copyright © 2020-2023  润新知