|
![]() |
#1 |
Moderator
|
Произвольное дерево в лукап форме
1) Создать лукап форму, в нее добавить элемент Tree 2) методы формы (таблица дерева WCCategory) X++: void selectItem() { FormTreeItem fti = tree.getItem(tree.getSelection()); ; if (fti.data()) this.closeSelect(fti.data()); } public void closeSelect(str _selectString) { if (_selectString) super(_selectString); } void createBranch(EShopCategoryId _categoryId = 0, int _idx = 0) { WCCategory wcCategory, wcCategoryChild; FormTreeItem fti; int idx; ; while select wcCategory where wcCategory.ParentId == _categoryId { select wcCategoryChild where wcCategoryChild.ParentId == wcCategory.CategoryId; fti = new FormTreeItem( wcCategory.Name, 0, wcCategoryChild ? 1 : 0, wcCategory.CategoryId); idx = tree.addItem(_idx, 0, fti); element.createBranch(wcCategory.CategoryId, idx); } } public void run() { element.createBranch(); super(); } X++: public int mouseDblClick(int _x, int _y, int _button, boolean _Ctrl, boolean _Shift) { #FORMTREECONTROL int ret; int idx; int focus; ret = super(_x, _y, _button, _Ctrl, _Shift); [idx, focus] = this.hitTest(_x, _y); if (focus & #FTCHT_ONITEM) element.selectItem(); return ret; } |
|