Jump to content

unitreeview node checkbox, how?


uniguicn

Recommended Posts

  • 1 month later...
Hi uniguicn.
 
Yes, this feature is currently not implemented.
But you can implement it this way:
 
uses ... uniGUIApplication ...
procedure TMainForm.UniButton1Click(Sender: TObject);
var node: TUniTreeNode;
begin  
  //node := UniTreeView1.Items.AddChild(SelectedNode, 'TestNode');
  node := UniTreeView1.Items.AddChild(nil, 'TestNode');
  node.Selected := True;

  //set(''checked'', false); OR set(''checked'', true);
  UniSession.AddJS('if (' + UniTreeView1.JSName + '.getSelectionModel().hasSelection()) {'+UniTreeView1.JSName+'.getSelectionModel().getSelection()[0].set(''checked'', false);};');   
end;

   

post-906-0-55569700-1380690262_thumb.png
 
Sincerely ...
  • Upvote 1
Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...

yes good example!

 

how can autogenerate subnode on node parents, like this example but with a

select date_format(m.fecha, '%Y/%c/%d') fecha,u.id_usuario, u.usuario recibe,m.id_mensaje, m.mensaje from mensaje m, usuarios u where m.id_usuarioe = u.id_usuario and m.recibido = 1 and m.id_usuarior = 3 and m.id_usuarioe = 5 order by m.id_mensaje

using field mensaje for all dates with the same date.

like this image:treewiew01.jpg

PLEASE HELP ME.

THANK YOU

Link to comment
Share on other sites

Workaround:

I use this code

UniMainModule.MyQuerytempo.SQL.Clear;
    UniMainModule.MyQuerytempo.Close;
    UniMainModule.MyQuerytempo.SQL.Add('select date_format(m.fecha, ''%Y/%c/%d'') fecha, count(*) cuantos from mensaje m, usuarios u where m.id_usuarioe = u.id_usuario and m.recibido = 1 and m.id_usuarior = :precibe and m.id_usuarioe = :penvia group by date_format(m.fecha, ''%Y/%c/%d'')');
    UniMainModule.MyQuerytempo.ParamByName('precibe').AsInteger := receptor;
    UniMainModule.MyQuerytempo.ParamByName('penvia').AsInteger := emisor;
    UniMainModule.MyQuerytempo.Open;
    //UniTreeView1.Items.Clear;                  // en lugar de usar el CLEAR,
    while UniTreeView1.Items.Count > 0 do begin  // se usara este ciclo procedimiento que nos limpiara
     UniTreeView1.Items[0].Free;                 // desde el primero hasta el ultimo
    end;                                         // siempre borrando el primero, hasta que no exista nada
    while not UniMainModule.MyQuerytempo.Eof do
    begin
      UniTreeView1.Items.AddChild(SelectedNode,UniMainModule.MyQuerytempo.FieldByName('fecha').AsString);
      UniMainModule.MyQuerytempo.Next;
    end;
    UniMainModule.MyQuerytempo.SQL.Clear;
    UniMainModule.MyQuerytempo.Close;
    UniMainModule.MyQuerytempo.SQL.Add('select date_format(m.fecha, ''%Y/%c/%d'') fecha,u.id_usuario, u.usuario recibe,m.id_mensaje, m.mensaje'+' from mensaje m, usuarios u where m.id_usuarioe = u.id_usuario and m.recibido = 1 and m.id_usuarior = :precibe and m.id_usuarioe = :penvia order by m.id_mensaje');
    UniMainModule.MyQuerytempo.ParamByName('precibe').AsInteger := receptor;
    UniMainModule.MyQuerytempo.ParamByName('penvia').AsInteger := emisor;
    UniMainModule.MyQuerytempo.Open;
    while not UniMainModule.MyQuerytempo.Eof do
    begin
      for i := 0 to UniTreeView1.Items.Count do
      begin
         if UniTreeView1.Items[i].Text = unimainmodule.MyQuerytempo.FieldByName('fecha').AsString then
         begin
            UniTreeView1.Items.AddChild(UniTreeView1.Items[i],unimainmodule.MyQuerytempo.FieldByName('mensaje').AsString);
            UniMainModule.MyQuerytempo.Next;
         end;
      end;
    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...