//------------------------------------------------------------------------------ //Callback Name: dialogShown_cb //This callback is executed just before the dialog launch. Thus any value set //here will take precedence and dialog will be launched showing that value. //------------------------------------------------------------------------------ public void dialogShown_cb() { //GetSelectedObjects(); int index = explorer.CurrentNode; Tree currenTree = _tree_control0List[index]; _currentTool = _dataService.Data.ToolArray[index]; // fillDialog(_currentTool.ToolNumber); if (_currentTool.PossibleChoice.Length == 0 || _currentTool.PossibleChoice == null) { return; } try { //Добавляем колонки //Node firstN = currenTree.RootNode; //if (firstN != null) // text = firstN.DisplayText; //foreach (Tree tree in _tree_control0List) //{ currenTree.InsertColumn((int)Columns.Name, "название", 200); currenTree.InsertColumn((int)Columns.Type, "тип", 40); currenTree.InsertColumn((int)Columns.Length, "длина, мм", 60); currenTree.InsertColumn((int)Columns.SpindelMount, "шпиндель", 60); currenTree.InsertColumn((int)Columns.Descr, "описание", 150); currenTree.SetColumnResizePolicy((int)Columns.Name, Tree.ColumnResizePolicy.ResizeWithContents); currenTree.SetColumnResizePolicy((int)Columns.Type, Tree.ColumnResizePolicy.ResizeWithContents); currenTree.SetColumnResizePolicy((int)Columns.Length, Tree.ColumnResizePolicy.ResizeWithContents); currenTree.SetColumnResizePolicy((int)Columns.SpindelMount, Tree.ColumnResizePolicy.ResizeWithContents); currenTree.SetColumnResizePolicy((int)Columns.Descr, Tree.ColumnResizePolicy.ResizeWithContents); CreateAndAddNode(_currentTool, currenTree); //} //tree_control0.InsertColumn((int) Columns.Name, "название", 200); //tree_control0.InsertColumn((int) Columns.Type, "тип", 40); //tree_control0.InsertColumn((int)Columns.Length, "длина, мм", 60); //tree_control0.InsertColumn((int)Columns.SpindelMount, "крепеление", 60); //tree_control0.SetColumnResizePolicy((int) Columns.Name,Tree.ColumnResizePolicy.ConstantWidth); //tree_control0.SetColumnResizePolicy((int) Columns.Type,Tree.ColumnResizePolicy.ConstantWidth); //tree_control0.SetColumnResizePolicy((int)Columns.Length, Tree.ColumnResizePolicy.ConstantWidth); //tree_control0.SetColumnResizePolicy((int)Columns.SpindelMount, Tree.ColumnResizePolicy.ConstantWidth); } catch (Exception ex) { theUI.NXMessageBox.Show("Ошибка при создании колонок с возможными оправками", NXMessageBox.DialogType.Error, ex.ToString()); } }
//public void SetVisibleNodes(int num) //{ // _num = num; //} private void CreateAndAddNode(thNXTool nxTool, Tree tree) { var x = cnt; Node parentNode = null; foreach (var holder in nxTool.PossibleChoice) { Node node = tree.CreateNode(holder.HolderLibraryReference); //настройки ноды //"turn_holder_hand_left" левый держатель //"turn_holder_hand_neutral" нейтральный держатель //"turn_holder_round" круглый держатель // "snowflake" ??? // "sm_solid_punch_pierce_face" объёмная буква Т // "sm_solid_punch_tool" желтая объёмная буква Т // "cleanup" иконка метлы // "clock" часы // "hole_drill_size" сверло // "hole_tapered" конус похож на термооправку // "bc_pinned" - иконка похожа на цангу //"cclw" "clw" "od_55_l" "od_80_l" иконка токарного резца node.ForegroundColor = 201; //198 node.DisplayIcon = "sm_solid_punch_pierce_face"; //"extrude", "cone", "block", "blend" node.SelectedIcon = "sm_solid_punch_tool"; //вставляем ноды в дерево tree.InsertNode(node, parentNode, null, Tree.NodeInsertOption.Sort); string type = holder.HolderSubType == thNXToolHolder.HolderType.Collet ? holder.ColletSize.ToString() : holder.HolderSubType.ToString(); node.SetColumnDisplayText((int)Columns.Type, type); node.SetColumnDisplayText((int)Columns.Length, holder.Length.ToString()); node.SetColumnDisplayText((int)Columns.SpindelMount, holder.HolderSpindelMount.ToString()); node.SetColumnDisplayText((int)Columns.Descr, holder.Description); node.ScrollTo((int)Columns.Name, Node.Scroll.Center); cnt++; } }