DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: melqui
今日帖子: 14
在线用户: 25
导航: 论坛 -> DELPHI技术 斑竹:liumazi,sephil  
作者:
男 zhouying (zy) ★☆☆☆☆ -
盒子活跃会员
2020/1/4 23:38:19
标题:
关于是不是treeview的逻辑问题 浏览:754
加入我的收藏
楼主: 想要在treeview中实现个功能,即当用户在点中某个列表内容之后,如果选择否,则自动调到其他的内容条上,并执行此内容条上响应的onchange功能。问题在于这个onchange始终要点击2次否之后才会执行。代码如下
          IDCANCEL:
          begin          
          TreeView1Change(TreeView1, TreeView1.Items[0]);
          TreeView1.Select(TreeView1.Items[0]);

那位大哥帮忙指点下啊。
----------------------------------------------
-
作者:
男 arhaha (lin) ★☆☆☆☆ -
盒子活跃会员
2020/1/5 8:54:00
1楼: 感觉我这个人有一个强迫症倾向,看到问的问题描述很是不清,或者错字连篇的,就不会有想去帮其回答的心情。这真的是一种毛病?或者我现在跟贴了,是不是已经在克服这个毛病的路上了按此在新窗口浏览图片
----------------------------------------------
-
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2020/1/5 10:08:11
2楼: Here my code to "access" my FRAMES using OnCLICK on TreeView selection:

use like you want!!! if need use ONChange the logic can be the same or different!


procedure TfrmFormMainExec.tvMyFramesInfoClick(Sender: TObject);
var
  lMyTreeNodeSelected: TTreeNode;
  lMyFrameSelected: TFrame;
  lMyComponentInTheFrame: TComponent;
  //...
begin
  //
  lMyTreeNodeSelected := (Sender as TTreeView).Selected;
  //
  if (lMyTreeNodeSelected <> nil) then
  begin
    if (lMyTreeNodeSelected.Data <> nil) and (TObject(lMyTreeNodeSelected.Data).InheritsFrom(TFrame)) then
    begin
      lMyFrameSelected := TFrame(TObject(lMyTreeNodeSelected.Data));
      // find by "Class"
      lMyComponentInTheFrame := fncFindMyFirstComponentType(lMyFrameSelected, TMaskEdit); // grdpnlOnTheForm.FindComponent('Edit1')
      //
      if (lMyComponentInTheFrame <> nil) then
      begin
        TEdit(lMyComponentInTheFrame).SetFocus;
        TEdit(lMyComponentInTheFrame).Color := clGreen;
        //
        if (lLastEditFocused <> nil) and (lLastEditFocused <> lMyComponentInTheFrame) then
          lLastEditFocused.Color := clWindow;
        //
        lLastEditFocused := TEdit(lMyComponentInTheFrame);
      end;
      //
      // ShowMessage(Format('%s, is a [Frame]'#13#10'Im on [%s]', [lMyTreeNodeSelected.Text, lMyFrameSelected.Name]));
    end else begin
      if (lLastEditFocused <> nil) then
        lLastEditFocused.SetFocus;
      //
      ShowMessage(lMyTreeNodeSelected.Text + ', This Object is [NIL]');
    end;
  end;
end;
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 zhouying (zy) ★☆☆☆☆ -
盒子活跃会员
2020/1/6 16:14:02
3楼: 就比如说,想要通过点击一个Button, 来实现原本Treeview1.onchange的事件
----------------------------------------------
-
作者:
男 zhouying (zy) ★☆☆☆☆ -
盒子活跃会员
2020/2/17 22:55:24
4楼: 有哪个兄弟知道吗?
----------------------------------------------
-
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行62.5毫秒 RSS